mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57:55 +08:00
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:
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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 "*"; }
|
||||
}
|
@@ -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" />
|
||||
|
Reference in New Issue
Block a user