using System; using System.Collections.Generic; using Umbraco.Web.PublishedCache; namespace Umbraco.Web.Routing { /// /// Provides context for the routing of a request. /// public class RoutingContext { private readonly Lazy _urlProvider; private readonly Lazy> _publishedContentFinders; private readonly Lazy _publishedContentLastChanceFinder; /// /// Initializes a new instance of the class. /// /// /// The document lookups resolver. /// /// The nice urls provider. internal RoutingContext( UmbracoContext umbracoContext, IEnumerable contentFinders, IContentFinder contentLastChanceFinder, UrlProvider urlProvider) { UmbracoContext = umbracoContext; _publishedContentFinders = new Lazy>(() => contentFinders, false); _publishedContentLastChanceFinder = new Lazy(() => contentLastChanceFinder, false); _urlProvider = new Lazy(() => urlProvider, false); } internal RoutingContext( UmbracoContext umbracoContext, Lazy> contentFinders, Lazy contentLastChanceFinder, Lazy urlProvider) { UmbracoContext = umbracoContext; _publishedContentFinders = contentFinders; _publishedContentLastChanceFinder = contentLastChanceFinder; _urlProvider = urlProvider; } /// /// Gets the Umbraco context. /// public UmbracoContext UmbracoContext { get; private set; } /// /// Gets the published content finders. /// internal IEnumerable PublishedContentFinders { get { return _publishedContentFinders.Value; } } /// /// Gets the published content last chance finder. /// internal IContentFinder PublishedContentLastChanceFinder { get { return _publishedContentLastChanceFinder.Value; } } /// /// Gets the urls provider. /// public UrlProvider UrlProvider { get { return _urlProvider.Value; } } } }