Implements singly registered RoutesCache object and re-interfaces IRoutesCache which can now be

set at runtime. Exposes UmbracoContext via DocumentRequest which simplifies some things. Removes
dependency on UmbracoContext from DefaultRoutesCache, now InPreviewMode is checked before passing
processing to the IRoutesCache provider. Changed NiceUrls to NiceUrlResolver.
This commit is contained in:
shannon@ShandemVaio
2012-07-20 23:10:43 +06:00
parent 1b9e226f61
commit 6c872e8a65
13 changed files with 228 additions and 145 deletions

View File

@@ -37,11 +37,9 @@ namespace Umbraco.Web
UmbracoContext.Current = umbracoContext;
//create a content store
var contentStore = new ContentStore(umbracoContext);
//create the routes cache
var routesCache = new RoutesCache(umbracoContext);
var contentStore = new ContentStore(umbracoContext);
//create the nice urls
var niceUrls = new NiceUrls(contentStore, umbracoContext, routesCache);
var niceUrls = new NiceUrlResolver(contentStore, umbracoContext, RoutesCache.Current.GetProvider());
//create the RoutingEnvironment (one per http request as it relies on the umbraco context!)
var routingEnvironment = new RoutingEnvironment(
ApplicationContext.Current.Plugins.ResolveLookups().ToArray(),
@@ -49,9 +47,15 @@ namespace Umbraco.Web
contentStore);
// create the new document request which will cleanup the uri once and for all
var docreq = new DocumentRequest(uri, routingEnvironment, umbracoContext, niceUrls);
// initialize the document request on the UmbracoContext (this is circular dependency!!!)
//NOTE: we are putting these objects on the UmbracoContext because these might be handy for developers in the future to
// access if we make them public.
// initialize the DocumentRequest on the UmbracoContext (this is circular dependency!!!)
umbracoContext.DocumentRequest = docreq;
// initialize the RoutingEnvironment on the UmbracoContext (this is circular dependency!!!)
umbracoContext.RoutingEnvironment = routingEnvironment;
// initialize the RoutingEnvironment on the UmbracoContext (this is circular dependency!!!)
umbracoContext.NiceUrlResolver = niceUrls;
//create the LegacyRequestInitializer (one per http request as it relies on the umbraco context!)
var legacyRequestInitializer = new LegacyRequestInitializer(umbracoContext);