diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs b/src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs index b73d82ac7..5210e22dd 100644 --- a/src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs +++ b/src/Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs @@ -14,30 +14,29 @@ namespace Orchard.Specs.Hosting.Orchard.Web { protected void Application_Start() { _hostContainer = OrchardStarter.CreateHostContainer(MvcSingletons); _host = _hostContainer.Resolve(); - Host.Initialize(); + _host.Initialize(); var route = RouteTable.Routes.MapRoute("foo", "hello-world", new { controller = "Home", action = "Index" }); route.RouteHandler = new HelloYetAgainHandler(); } protected void Application_BeginRequest() { - Host.BeginRequest(); + Context.Items["originalHttpContext"] = Context; + + _host.BeginRequest(); } protected void Application_EndRequest() { - Host.EndRequest(); + _host.EndRequest(); } protected void MvcSingletons(ContainerBuilder builder) { - builder.RegisterInstance(ControllerBuilder.Current); - builder.RegisterInstance(RouteTable.Routes); - builder.RegisterInstance(ModelBinders.Binders); - builder.RegisterInstance(ModelMetadataProviders.Current); - builder.RegisterInstance(ViewEngines.Engines); - } + builder.Register(ctx => RouteTable.Routes).SingleInstance(); + builder.Register(ctx => ModelBinders.Binders).SingleInstance(); + builder.Register(ctx => ViewEngines.Engines).SingleInstance(); - public static IOrchardHost Host { - get { return _host; } + builder.RegisterInstance(ControllerBuilder.Current); + builder.RegisterInstance(ModelMetadataProviders.Current); } public static void ReloadExtensions() { @@ -46,7 +45,14 @@ namespace Orchard.Specs.Hosting.Orchard.Web { public static IWorkContextScope CreateStandaloneEnvironment(string name) { var settings = _hostContainer.Resolve().LoadSettings().SingleOrDefault(x => x.Name == name); - return Host.CreateStandaloneEnvironment(settings); + if (settings == null) { + settings = new ShellSettings { + Name = name, + State = new TenantState("Uninitialized") + }; + } + + return _host.CreateStandaloneEnvironment(settings); } } } \ No newline at end of file diff --git a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config index 0d0717530..382a40d28 100644 --- a/src/Orchard.Specs/Hosting/Orchard.Web/Web.config +++ b/src/Orchard.Specs/Hosting/Orchard.Web/Web.config @@ -8,24 +8,30 @@ \Windows\Microsoft.Net\Framework\v2.x\Config --> - - - -
- -
-
-
-
- - + +
+
+ - + + + + + + + + + + + + + + - + + + + - - + - - - - + @@ -62,52 +69,16 @@ ASP.NET to identify an incoming user. --> - + - - - - - - - - - - - - - - - - - + - - + + - - - - - - - - - - + + @@ -131,83 +95,35 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + - \ No newline at end of file