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
This commit is contained in:
Louis DeJardin
2010-02-08 16:01:54 -08:00
parent 56c2fdbb06
commit 9990412c63
2 changed files with 25 additions and 6 deletions

View File

@@ -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();
}
}
}
}

View File

@@ -2,9 +2,25 @@ using Orchard.Environment.Configuration;
namespace Orchard.Environment {
public interface IOrchardHost {
/// <summary>
/// Called once on startup to configure app domain, and load/apply existing shell configuration
/// </summary>
void Initialize();
/// <summary>
/// Called each time a request ends to deterministically commit and dispose outstanding activity
/// </summary>
void EndRequest();
/// <summary>
/// Called when configuration changes requires the shell topology to be reloaded and applied
/// </summary>
void Reinitialize();
/// <summary>
/// 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.
/// </summary>
IStandaloneEnvironment CreateStandaloneEnvironment(IShellSettings shellSettings);
}
}