Orchard Multi-tenenacy Enable features selected 。

Orchard Multi-tenenacy Enable features selected .

我正在尝试找到一种方法来启用已在多租户设置中选择的功能。

我尝试在 "Orchard.Setup" 的设置构造函数中添加 IModuleService 以在租户设置好他的设置后启用选定的功能。但我有一个注入异常。

: 'None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Orchard.Setup.Controllers.SetupController' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Modules.Services.IModuleService Services' of constructor 'Void .ctor(Orchard.UI.Notify.INotifier, Orchard.Setup.Services.ISetupService, 

还有其他方法可以实现吗?

我设法让它工作在构造函数外解析 IFeatureManager :

        using (var environment = _orchardHost.CreateStandaloneEnvironment(shellSettings))
        {
            var FeatureManager = environment.Resolve<IFeatureManager>();
            var FeatureIds= FeatureManager.GetAvailableFeatures().Where(x => x.Name == "MyModule").Select(x => x.Id);
            FeatureManager.EnableFeatures(FeatureIds);
        }