Renaming some Setup components to SafeMode

In the environment namespace the fact that it's a setup scenario isn't important
This may also be in effect when the app is in a "barely running" state, which has nothing to do with setup

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-02-05 12:05:26 -08:00
parent 69c2d9475d
commit c9b4d63f51
4 changed files with 15 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void FactoryShouldCreateContainerThatProvidesShell() {
var factory = new SetupShellContainerFactory(_hostContainer);
var factory = new SafeModeShellContainerFactory(_hostContainer);
var shellContainer = factory.CreateContainer(null);
Assert.That(shellContainer, Is.Not.Null);
var shell = shellContainer.Resolve<IOrchardShell>();
@@ -35,7 +35,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ShellContainerShouldProvideLayoutViewEngine() {
var factory = new SetupShellContainerFactory(_hostContainer);
var factory = new SafeModeShellContainerFactory(_hostContainer);
var shellContainer = factory.CreateContainer(null);
var viewEngineFilter = shellContainer.Resolve<IEnumerable<IFilterProvider>>()
.Single(f=>f is ViewEngineFilter);

View File

@@ -23,7 +23,7 @@ namespace Orchard.Environment {
builder.Register<DefaultCompositionStrategy>().As<ICompositionStrategy>().SingletonScoped();
builder.Register<DefaultShellContainerFactory>().As<IShellContainerFactory>().SingletonScoped();
builder.Register<ShellSettingsLoader>().As<IShellSettingsLoader>().SingletonScoped();
builder.Register<SetupShellContainerFactory>().As<IShellContainerFactory>().SingletonScoped();
builder.Register<SafeModeShellContainerFactory>().As<IShellContainerFactory>().SingletonScoped();
// The container provider gives you access to the lowest container at the time,
// and dynamically creates a per-request container. The DisposeRequestContainer method

View File

@@ -21,10 +21,10 @@ using Orchard.UI.PageTitle;
using Orchard.UI.Zones;
namespace Orchard.Environment.ShellBuilders {
public class SetupShellContainerFactory : IShellContainerFactory {
public class SafeModeShellContainerFactory : IShellContainerFactory {
private readonly IContainer _container;
public SetupShellContainerFactory(IContainer container) {
public SafeModeShellContainerFactory(IContainer container) {
_container = container;
}
@@ -37,6 +37,7 @@ namespace Orchard.Environment.ShellBuilders {
var shellContainer = _container.CreateInnerContainer();
shellContainer.Build(builder => {
//review: group by default vs safemode service replacements
builder.Register<DefaultOrchardShell>().As<IOrchardShell>().SingletonScoped();
builder.Register<RoutePublisher>().As<IRoutePublisher>().SingletonScoped();
builder.Register<ModelBinderPublisher>().As<IModelBinderPublisher>().SingletonScoped();
@@ -47,11 +48,12 @@ namespace Orchard.Environment.ShellBuilders {
builder.Register<WebFormsViewEngineProvider>().As<IViewEngineProvider>().ContainerScoped();
builder.Register<ViewEngineFilter>().As<IFilterProvider>().ContainerScoped();
builder.Register<SafeModeThemeService>().As<IThemeService>().SingletonScoped();
builder.Register<SetupText>().As<IText>().SingletonScoped();
builder.Register<SafeModeText>().As<IText>().SingletonScoped();
builder.Register<PageTitleBuilder>().As<IPageTitleBuilder>().SingletonScoped();
builder.Register<SetupSiteService>().As<ISiteService>().SingletonScoped();
builder.Register<ZoneManager>().As<IZoneManager>().SingletonScoped();
builder.Register<PageClassBuilder>().As<IPageClassBuilder>().SingletonScoped();
builder.Register<SafeModeSiteService>().As<ISiteService>().SingletonScoped();
});
shellContainer.Build(builder => {
@@ -63,7 +65,7 @@ namespace Orchard.Environment.ShellBuilders {
return shellContainer;
}
//review: this should come from the subset of modules, not this factory
class SetupRouteProvider : IRouteProvider {
public IEnumerable<RouteDescriptor> GetRoutes() {
var routes = new List<RouteDescriptor>();
@@ -83,7 +85,7 @@ namespace Orchard.Environment.ShellBuilders {
}
}
class SetupText : IText {
class SafeModeText : IText {
public LocalizedString Get(string textHint, params object[] args) {
if (args == null || args.Length == 0) {
return new LocalizedString(textHint);
@@ -122,17 +124,17 @@ namespace Orchard.Environment.ShellBuilders {
public void GenerateActivateEvents() { }
}
class SetupSiteService : ISiteService {
class SafeModeSiteService : ISiteService {
public ISite GetSiteSettings() {
var site = new ContentItemBuilder("site")
.Weld<SetupSite>()
.Weld<SafeModeSite>()
.Build();
return site.As<ISite>();
}
}
class SetupSite : ContentPart, ISite {
class SafeModeSite : ContentPart, ISite {
public string PageTitleSeparator {
get { return "*"; }
}

View File

@@ -137,7 +137,7 @@
<Compile Include="Environment\ExtensibleInterceptionModule.cs" />
<Compile Include="Environment\ShellBuilders\DefaultShellContainerFactory.cs" />
<Compile Include="Environment\ShellBuilders\IShellContainerFactory.cs" />
<Compile Include="Environment\ShellBuilders\SetupShellContainerFactory.cs" />
<Compile Include="Environment\ShellBuilders\SafeModeShellContainerFactory.cs" />
<Compile Include="Environment\Configuration\ShellSettings.cs" />
<Compile Include="Extensions\AreaFolders.cs" />
<Compile Include="Extensions\ExtensionFolders.cs" />