기본 구성이 없습니다. 그러나 당신은 당신 자신의 것을 구현할 수 있습니다. 모듈 (사이트의 일부 핵심 모듈)에 이벤트 처리기를 추가하십시오. 응용 프로그램이 시작되면 다음 코드가 실행됩니다.
public class MyHandler : IOrchardShellEvents
{
private readonly IModuleService _moduleService;
public MyHandler(IModuleService moduleService)
{
_moduleService = moduleService;
}
public void Activated() {
bool isProduction;
if (bool.TryParse(ConfigurationManager.AppSettings["IsProduction"], out isProduction)) {
var features = _moduleService.GetAvailableFeatures().ToDictionary(m => m.Descriptor.Id, m => m);
if (features.ContainsKey("Orchard.Email"))
{
if (features["Orchard.Email"].IsEnabled && !isProduction) {
_moduleService.DisableFeatures(new string[] {"Orchard.Email"});
}
else if (!features["Orchard.Email"].IsEnabled && isProduction)
{
_moduleService.EnableFeatures(new string[] { "Orchard.Email" });
}
}
}
}
public void Terminating() {}
}
그리고 당신의 web.config 파일에 설정을 추가
<appSettings>
<add key="IsProduction" value="true"/>
</appSettings>