Asp.net mvc 覆盖Orchard CMS中的Orchard设置视图
我需要从Orchard.Setup模块扩展SetupViewModel,以添加一些特定于我的web应用程序的选项,以便它们与标准管理员用户名一起显示在“欢迎来到Orchard”设置屏幕上,等等。 我已经用SetupController和扩展视图模型创建了自己的模块,但Orchard仍然使用标准的Orchard.Setup模块。 到目前为止我尝试过但没有成功: 1.OrchardSuppress在我的自定义模块中对控制器的依赖性 2.我的自定义模块中优先级为101的路由 我发现,如果在ShellContextFactory CreateSetupContext方法中更改ShallFeature名称,您可以轻松地使用自己的模块进行设置:Asp.net mvc 覆盖Orchard CMS中的Orchard设置视图,asp.net-mvc,orchardcms,orchardcms-1.8,Asp.net Mvc,Orchardcms,Orchardcms 1.8,我需要从Orchard.Setup模块扩展SetupViewModel,以添加一些特定于我的web应用程序的选项,以便它们与标准管理员用户名一起显示在“欢迎来到Orchard”设置屏幕上,等等。 我已经用SetupController和扩展视图模型创建了自己的模块,但Orchard仍然使用标准的Orchard.Setup模块。 到目前为止我尝试过但没有成功: 1.OrchardSuppress在我的自定义模块中对控制器的依赖性 2.我的自定义模块中优先级为101的路由 我发现,如果在ShellC
public ShellContext CreateSetupContext(ShellSettings settings) {
Logger.Debug("No shell settings available. Creating shell context for setup");
var descriptor = new ShellDescriptor {
SerialNumber = -1,
Features = new[] {
new ShellFeature { Name = "YOUR_MODULE_NAME" },
new ShellFeature { Name = "Shapes" },
new ShellFeature { Name = "Orchard.jQuery" },
},
};
var blueprint = _compositionStrategy.Compose(settings, descriptor);
var shellScope = _shellContainerFactory.CreateContainer(settings, blueprint);
return new ShellContext {
Settings = settings,
Descriptor = descriptor,
Blueprint = blueprint,
LifetimeScope = shellScope,
Shell = shellScope.Resolve<IOrchardShell>(),
};
}
公共ShellContext CreateSetupContext(ShellSettings){
Debug(“没有可用的shell设置。正在为安装程序创建shell上下文”);
var描述符=新的外壳描述符{
SerialNumber=-1,
功能=新[]{
新的ShellFeature{Name=“YOUR_MODULE_Name”},
新的外壳特征{Name=“Shapes”},
新的ShellFeature{Name=“Orchard.jQuery”},
},
};
var blueprint=_compositionStrategy.Compose(设置、描述符);
var shellScope=\u shellContainerFactory.CreateContainer(设置,蓝图);
返回新的shell上下文{
设置=设置,
描述符=描述符,
蓝图=蓝图,
寿命范围=外壳范围,
Shell=shellScope.Resolve(),
};
}
但我似乎无法覆盖IShellContextFactory,即使是使用OrchardSuppressDependency,至少在安装时是这样
关于如何在不更改CMS代码的情况下实现所需的结果,有什么想法吗
Orchard版本是1.8.1。所以,这并不是我想要达到的目标,但它确实是一种东西。要覆盖Orachard安装过程中使用的IShellContextFactory,可以使用Host.config文件。 例如:
至少你不必改变果园的来源。所以,这并不是我想要实现的目标,但它确实是一个目标。要覆盖Orachard安装过程中使用的IShellContextFactory,可以使用Host.config文件。 例如:
至少你不必改变果园资源
<autofac>
<components>
<component instance-scope="single-instance" type="YourModuleNamespace.ShellBuilders.CustomContextFactory, YourModuleName" service="Orchard.Environment.ShellBuilders.IShellContextFactory, Orchard.Framework" />
</components>
</autofac>