Further progress towards tenant-specific routing

Ability to follow redirects from integration tests
Route publisher wraps handler with ShellRoute which controls request lifetime scope
ShellRoute at the moment is restricted to "Default" - host and prefix TBD
Route publisher remove-and-insert routes for a specific tenant to allow incremental and repeated shell route publish
Offers a more deterministic knowledge of which shell container is used than just-in-time http context
Removes Autofac default httpmodule, controller factory, httpapplication icontainerprovideraccessor, etc
Adds support for optional ~/Config/Sites.{yourtenantname}.config file for manual per-shell component override
Integration tests capture Orchard and NHibernate trace output. Levels are configurable in orchard.specs diagnostics.config
Concept of IRunningShellTable instroduced. Might not be needed - will be removed if so.

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-22 12:23:58 -07:00
parent eaf553b048
commit 79431a11a2
34 changed files with 863 additions and 265 deletions

View File

@@ -15,9 +15,8 @@ namespace Orchard.Web {
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : HttpApplication, IContainerProviderAccessor {
public class MvcApplication : HttpApplication {
private static IOrchardHost _host;
private static IContainerProvider _containerProvider;
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
@@ -31,11 +30,6 @@ namespace Orchard.Web {
new Version("2.0.50129.0")/*MVC2 RC2 file version #*/,
new Version("2.0.41211.0")/*MVC2 RC file version #*/);
var builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
_containerProvider = new ContainerProvider(builder.Build());
ControllerBuilder.Current.SetControllerFactory(new AutofacControllerFactory(ContainerProvider));
RegisterRoutes(RouteTable.Routes);
_host = OrchardStarter.CreateHost(MvcSingletons);
@@ -108,14 +102,5 @@ namespace Orchard.Web {
builder.RegisterInstance(ViewEngines.Engines);
}
#region Implementation of IContainerProviderAccessor
public IContainerProvider ContainerProvider {
get {
return _containerProvider;
}
}
#endregion
}
}

View File

@@ -33,10 +33,8 @@ namespace Orchard.MultiTenancy.Controllers {
}
[HttpPost, ActionName("Add")]
public ActionResult AddPOST() {
var viewModel = new TenantsAddViewModel();
public ActionResult AddPOST(TenantsAddViewModel viewModel) {
try {
UpdateModel(viewModel);
if (!Services.Authorizer.Authorize(Permissions.ManageTenants, T("Couldn't create tenant")))
return new HttpUnauthorizedResult();
_tenantService.CreateTenant(

View File

@@ -144,7 +144,6 @@
</httpHandlers>
<httpModules>
<add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
@@ -178,7 +177,6 @@
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="ContainerDisposal" type="Autofac.Integration.Web.ContainerDisposalModule, Autofac.Integration.Web"/>
<remove name="ScriptModule" />
<remove name="UrlRoutingModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>