Hello I currently try to set up a ABP project with some default settings. I want to enable the chat Module as default. What I currently have tried ...
Enable it in the FeatureConfigurator
public static class PortalGlobalFeatureConfigurator
{
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure()
{
OneTimeRunner.Run(() =>
{
GlobalFeatureManager.Instance.Modules.CmsKit(x => x.EnableAll());
GlobalFeatureManager.Instance.Modules.CmsKitPro(x => x.EnableAll());
GlobalFeatureManager.Instance.Modules.FeatureManager.Enable<ChatFeatures>();
GlobalFeatureManager.Instance.Modules.FeatureManager.Enable<LanguageManagementFeatures>();
});
}
}
But when I start the migration I am getting the following Exception:
define the Volo.Abp.GlobalFeatures.GlobalFeatureNameAttribute atttribute!
Enable it in the DataSeed
_featureManager.SetForTenantAsync(tenantId, FeatureNameConstants.Chat, "True");
But when I start the migration I am getting the following Exception
The Chat Module is not Enabled
How can I enable the feature in the first migration without UI interaction ?
Finally I figured out how to enable features as default. Maybe this will help others ...
Use the GlobalFeatureManager only for the CMS features as shown above. Inject the FeatureManager for instance in the SaasDataSeedContributer class
string feature = "Chat.Enable"
// For the null tenant
await _featureManager.SetAsync(feature, "True", "T", null);
// For every other tenant
await _featureManager.SetForTenantAsync(tenant.Id, feature, "True", true);