Added initial MVC supporting files and updated some unit tests.

This commit is contained in:
shannon@ShandemVaio
2012-08-07 21:40:34 +06:00
parent d9eb8b426c
commit d92d309c61
22 changed files with 793 additions and 64 deletions

View File

@@ -1,6 +1,10 @@
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Umbraco.Core;
using Umbraco.Web.Media.ThumbnailProviders;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
using umbraco.businesslogic;
@@ -29,6 +33,24 @@ namespace Umbraco.Web
ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper.FileMapVirtualFolder = "~/App_Data/TEMP/ClientDependency";
ClientDependency.Core.CompositeFiles.Providers.BaseCompositeFileProcessingProvider.UrlTypeDefault = ClientDependency.Core.CompositeFiles.Providers.CompositeUrlType.Base64QueryStrings;
//set master controller factory
ControllerBuilder.Current.SetControllerFactory(
new MasterControllerFactory(FilteredControllerFactoriesResolver.Current));
//set the render view engine
ViewEngines.Engines.Add(new RenderViewEngine());
//set model binder
ModelBinders.Binders.Add(new KeyValuePair<Type, IModelBinder>(typeof(RenderModel), new RenderModelBinder()));
//set routes
var route = RouteTable.Routes.MapRoute(
"Umbraco_default",
"Umbraco/RenderMvc/{action}/{id}",
new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional }
);
route.RouteHandler = new RenderRouteHandler(ControllerBuilder.Current.GetControllerFactory());
//find and initialize the application startup handlers
ApplicationStartupHandler.RegisterHandlers();
@@ -42,19 +64,27 @@ namespace Umbraco.Web
{
base.InitializeResolvers();
FilteredControllerFactoriesResolver.Current = new FilteredControllerFactoriesResolver(
//add all known factories, devs can then modify this list on application startup either by binding to events
//or in their own global.asax
new[]
{
typeof (RenderControllerFactory)
});
LastChanceLookupResolver.Current = new LastChanceLookupResolver(new DefaultLastChanceLookup());
DocumentLookupsResolver.Current = new DocumentLookupsResolver(
//add all known resolvers in the correct order, devs can then modify this list on application startup either by binding to events
//or in their own global.asax
new Type[]
{
typeof(LookupByNiceUrl),
typeof(LookupById),
typeof(LookupByNiceUrlAndTemplate),
typeof(LookupByProfile),
typeof(LookupByAlias)
});
new[]
{
typeof (LookupByNiceUrl),
typeof (LookupById),
typeof (LookupByNiceUrlAndTemplate),
typeof (LookupByProfile),
typeof (LookupByAlias)
});
RoutesCacheResolver.Current = new RoutesCacheResolver(new DefaultRoutesCache());