--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-09-20 16:17:50 -07:00
3 changed files with 54 additions and 19 deletions

View File

@@ -170,6 +170,9 @@ namespace Orchard.Setup.Services {
}
}
while (_processingEngine.AreTasksPending())
_processingEngine.ExecuteNextTask();
_shellSettingsManager.SaveSettings(shellSettings);
return executionId;

View File

@@ -51,8 +51,8 @@ namespace Orchard.Setup {
builder.RegisterType<RoutePublisher>().As<IRoutePublisher>().InstancePerLifetimeScope();
builder.RegisterType<ModelBinderPublisher>().As<IModelBinderPublisher>().InstancePerLifetimeScope();
builder.RegisterType<WebFormViewEngineProvider>().As<IViewEngineProvider>().As<IShapeTemplateViewEngine>().InstancePerLifetimeScope();
builder.RegisterType<RazorViewEngineProvider>().As<IViewEngineProvider>().As<IShapeTemplateViewEngine>().InstancePerLifetimeScope();
builder.RegisterType<WebFormViewEngineProvider>().As<IViewEngineProvider>().As<IShapeTemplateViewEngine>().SingleInstance();
builder.RegisterType<RazorViewEngineProvider>().As<IViewEngineProvider>().As<IShapeTemplateViewEngine>().SingleInstance();
builder.RegisterType<ThemedViewResultFilter>().As<IFilterProvider>().InstancePerLifetimeScope();
builder.RegisterType<ThemeFilter>().As<IFilterProvider>().InstancePerLifetimeScope();
builder.RegisterType<PageTitleBuilder>().As<IPageTitleBuilder>().InstancePerLifetimeScope();
@@ -81,21 +81,21 @@ namespace Orchard.Setup {
builder.RegisterType<DefaultCacheHolder>().As<ICacheHolder>().SingleInstance();
// in progress - adding services for display/shape support in setup
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>();
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>().InstancePerLifetimeScope();
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>().InstancePerLifetimeScope();
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>().InstancePerLifetimeScope();
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>().InstancePerLifetimeScope();
builder.RegisterType<ShapeTableLocator>().As<IShapeTableLocator>().InstancePerMatchingLifetimeScope("work");
builder.RegisterType<ThemeAwareViewEngine>().As<IThemeAwareViewEngine>();
builder.RegisterType<LayoutAwareViewEngine>().As<ILayoutAwareViewEngine>();
builder.RegisterType<ConfiguredEnginesCache>().As<IConfiguredEnginesCache>();
builder.RegisterType<LayoutWorkContext>().As<IWorkContextStateProvider>();
builder.RegisterType<SafeModeSiteWorkContextProvider>().As<IWorkContextStateProvider>();
builder.RegisterType<ThemeAwareViewEngine>().As<IThemeAwareViewEngine>().InstancePerLifetimeScope();
builder.RegisterType<LayoutAwareViewEngine>().As<ILayoutAwareViewEngine>().InstancePerLifetimeScope();
builder.RegisterType<ConfiguredEnginesCache>().As<IConfiguredEnginesCache>().SingleInstance();
builder.RegisterType<LayoutWorkContext>().As<IWorkContextStateProvider>().InstancePerLifetimeScope();
builder.RegisterType<SafeModeSiteWorkContextProvider>().As<IWorkContextStateProvider>().InstancePerLifetimeScope();
builder.RegisterType<ShapeTemplateBindingStrategy>().As<IShapeTableProvider>();
builder.RegisterType<BasicShapeTemplateHarvester>().As<IShapeTemplateHarvester>();
builder.RegisterType<ShapeAttributeBindingStrategy>().As<IShapeTableProvider>();
builder.RegisterType<ShapeTemplateBindingStrategy>().As<IShapeTableProvider>().InstancePerLifetimeScope();
builder.RegisterType<BasicShapeTemplateHarvester>().As<IShapeTemplateHarvester>().InstancePerLifetimeScope();
builder.RegisterType<ShapeAttributeBindingStrategy>().As<IShapeTableProvider>().InstancePerLifetimeScope();
builder.RegisterModule(new ShapeAttributeBindingModule());
}

View File

@@ -155,7 +155,7 @@ namespace Orchard.Environment {
_cacheManager.Get("OrchardHost_Extensions",
ctx => {
_extensionMonitoringCoordinator.MonitorExtensions(ctx.Monitor);
_hostLocalRestart.Monitor(ctx.Monitor);
// _hostLocalRestart.Monitor(ctx.Monitor);
DisposeShellContext();
return "";
});
@@ -187,12 +187,44 @@ namespace Orchard.Environment {
}
}
void IShellSettingsManagerEventHandler.Saved(ShellSettings settings) {
DisposeShellContext();
/// <summary>
/// Register and activate a new Shell when a tenant is created
/// </summary>
void IShellSettingsManagerEventHandler.Saved(ShellSettings settings)
{
// is it a new tenant ?
var shellContext = _current.FirstOrDefault(c => c.Settings.Name == settings.Name);
ShellContext context;
// if null, this is a new tenant, register and activate a new context
if(shellContext == null)
{
context = CreateShellContext(settings);
ActivateShell(context);
_current = _current.Union(new[] { context });
_runningShellTable.Add(settings);
}
else
{
context = _shellContextFactory.CreateShellContext(settings);
// dispose previous context
shellContext.Shell.Terminate();
shellContext.LifetimeScope.Dispose();
// activate and register modified context
_current = _current.Where(shell => shell.Settings.Name != settings.Name).Union(new[] { shellContext });
context.Shell.Activate();
_runningShellTable.Update(settings);
}
}
/// <summary>
/// A feature is enabled/disabled
/// </summary>
void IShellDescriptorManagerEventHandler.Changed(ShellDescriptor descriptor) {
DisposeShellContext();
}
}
}