From 83f76ed4a4dbf83611cf61b31fa1de138ffd2e2f Mon Sep 17 00:00:00 2001 From: sgay Date: Fri, 27 Jul 2012 14:06:41 -0200 Subject: [PATCH] cosmetic & doc --- .../Resolving/MultipleResolverBase.cs | 50 ++++++++++++++----- .../Routing/DocumentLookupsResolver.cs | 2 +- src/Umbraco.Web/Routing/DocumentRequest.cs | 4 +- src/Umbraco.Web/Umbraco.Web.csproj | 16 +++--- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/src/Umbraco.Core/Resolving/MultipleResolverBase.cs b/src/Umbraco.Core/Resolving/MultipleResolverBase.cs index 8fba742f58..77c892f93c 100644 --- a/src/Umbraco.Core/Resolving/MultipleResolverBase.cs +++ b/src/Umbraco.Core/Resolving/MultipleResolverBase.cs @@ -4,13 +4,13 @@ using System.Threading; namespace Umbraco.Core.Resolving { /// - /// A Resolver to return and set a Multiply registered object. + /// A Resolver which manages an ordered list of objects. /// - /// - /// + /// The type of the resolver. + /// The type of the resolved objects. /// /// Used to resolve multiple types from a collection. The collection can also be modified at runtime/application startup. - /// An example of this is MVCs ViewEngines collection + /// An example of this is MVCs ViewEngines collection. /// internal abstract class MultipleResolverBase : ResolverBase where TResolver : class @@ -19,39 +19,60 @@ namespace Umbraco.Core.Resolving readonly List _resolved; protected readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(); + /// + /// Initializes a new instance of the class with an empty list of objects. + /// protected MultipleResolverBase() { _resolved = new List(); } + /// + /// Initializes a new instance of the class with an initial list of objects. + /// + /// The list of objects. protected MultipleResolverBase(IEnumerable value) { _resolved = new List(value); - } + } - protected IEnumerable Values + /// + /// Gets the list of objects. + /// + protected IEnumerable Values { get { return _resolved; } } - public void Remove(TResolved item) + /// + /// Removes an object. + /// + /// The object to remove. + public void Remove(TResolved value) { Resolution.EnsureNotFrozen(); using (new WriteLock(Lock)) { - _resolved.Remove(item); + _resolved.Remove(value); } } - public void Add(TResolved item) + /// + /// Adds an object to the end of the list. + /// + /// The object to be added. + public void Add(TResolved value) { Resolution.EnsureNotFrozen(); using (new WriteLock(Lock)) { - _resolved.Add(item); + _resolved.Add(value); } } + /// + /// Clears the list. + /// public void Clear() { Resolution.EnsureNotFrozen(); @@ -61,12 +82,17 @@ namespace Umbraco.Core.Resolving } } - public void Insert(int index, TResolved item) + /// + /// Inserts an object at the specified index. + /// + /// The zero-based index at which the object should be inserted. + /// The object to insert. + public void Insert(int index, TResolved value) { Resolution.EnsureNotFrozen(); using (new WriteLock(Lock)) { - _resolved.Insert(index, item); + _resolved.Insert(index, value); } } diff --git a/src/Umbraco.Web/Routing/DocumentLookupsResolver.cs b/src/Umbraco.Web/Routing/DocumentLookupsResolver.cs index 29c7207801..168c65eed7 100644 --- a/src/Umbraco.Web/Routing/DocumentLookupsResolver.cs +++ b/src/Umbraco.Web/Routing/DocumentLookupsResolver.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Routing /// /// Gets the implementations. /// - public IEnumerable GetDocumentLookups + public IEnumerable DocumentLookups { get { return _lookups.Values; } } diff --git a/src/Umbraco.Web/Routing/DocumentRequest.cs b/src/Umbraco.Web/Routing/DocumentRequest.cs index 4aef634980..bc25fc0fbc 100644 --- a/src/Umbraco.Web/Routing/DocumentRequest.cs +++ b/src/Umbraco.Web/Routing/DocumentRequest.cs @@ -202,7 +202,7 @@ namespace Umbraco.Web.Routing // the first successful resolver, if any, will set this.Node, and may also set this.Template // some lookups may implement caching Trace.TraceInformation("{0}Begin resolvers", tracePrefix); - var lookups = RoutingContext.DocumentLookupsResolver.GetDocumentLookups; + var lookups = RoutingContext.DocumentLookupsResolver.DocumentLookups; lookups.Any(lookup => lookup.TrySetDocument(this)); Trace.TraceInformation("{0}End resolvers, {1}", tracePrefix, (this.HasNode ? "a document was found" : "no document was found")); @@ -243,7 +243,7 @@ namespace Umbraco.Web.Routing Trace.TraceInformation("{0}No document, try last chance lookup", tracePrefix); // if it fails then give up, there isn't much more that we can do - var lastChance = RoutingContext.DocumentLookupsResolver.RequestDocumentLastChanceResolver; + var lastChance = RoutingContext.DocumentLookupsResolver.DocumentLastChanceLookup; if (lastChance == null || !lastChance.TrySetDocument(this)) { Trace.TraceInformation("{0}Failed to find a document, give up", tracePrefix); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 7c296e3960..c2bf75bae1 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -240,8 +240,13 @@ - - + + + + + + + @@ -250,13 +255,6 @@ - - - - - - -