From 9990412c6376d690bb9f1fb8a35d03f08fdccbc9 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Mon, 8 Feb 2010 16:01:54 -0800 Subject: [PATCH] Adding a Reinitialize method to the IOrchardHost Needed for the setup scenario to be able to reload and apply new shell topology Eventyally needed when module configuration requires the same effect --HG-- branch : dev --- src/Orchard/Environment/DefaultOrchardHost.cs | 15 +++++++++------ src/Orchard/Environment/IOrchardHost.cs | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/Orchard/Environment/DefaultOrchardHost.cs b/src/Orchard/Environment/DefaultOrchardHost.cs index 2400fa3cc..7070a484e 100644 --- a/src/Orchard/Environment/DefaultOrchardHost.cs +++ b/src/Orchard/Environment/DefaultOrchardHost.cs @@ -1,3 +1,4 @@ +using System; using System.Linq; using System.Web.Mvc; using Autofac; @@ -36,6 +37,14 @@ namespace Orchard.Environment { } void IOrchardHost.Initialize() { + ViewEngines.Engines.Insert(0, LayoutViewEngine.CreateShim()); + _controllerBuilder.SetControllerFactory(new OrchardControllerFactory()); + ServiceLocator.SetLocator(t => _containerProvider.RequestContainer.Resolve(t)); + + Initialize(); + } + + void IOrchardHost.Reinitialize() { Initialize(); } @@ -54,10 +63,6 @@ namespace Orchard.Environment { shell.Activate(); _current = shell; - ViewEngines.Engines.Insert(0, LayoutViewEngine.CreateShim()); - _controllerBuilder.SetControllerFactory(new OrchardControllerFactory()); - ServiceLocator.SetLocator(t => _containerProvider.RequestContainer.Resolve(t)); - // Fire off one-time install events on an alternate container HackInstallSimulation(); @@ -123,7 +128,5 @@ namespace Orchard.Environment { containerProvider.DisposeRequestContainer(); } } - - } } \ No newline at end of file diff --git a/src/Orchard/Environment/IOrchardHost.cs b/src/Orchard/Environment/IOrchardHost.cs index ffb1706cf..0e0b62a3a 100644 --- a/src/Orchard/Environment/IOrchardHost.cs +++ b/src/Orchard/Environment/IOrchardHost.cs @@ -2,9 +2,25 @@ using Orchard.Environment.Configuration; namespace Orchard.Environment { public interface IOrchardHost { + /// + /// Called once on startup to configure app domain, and load/apply existing shell configuration + /// void Initialize(); + + /// + /// Called each time a request ends to deterministically commit and dispose outstanding activity + /// void EndRequest(); + /// + /// Called when configuration changes requires the shell topology to be reloaded and applied + /// + void Reinitialize(); + + /// + /// Can be used to build an temporary self-contained instance of a shell's configured code. + /// Services may be resolved from within this instance to configure and initialize it's storage. + /// IStandaloneEnvironment CreateStandaloneEnvironment(IShellSettings shellSettings); } }