首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >默认启用ABP框架聊天模块

默认启用ABP框架聊天模块
EN

Stack Overflow用户
提问于 2022-06-01 10:09:42
回答 1查看 165关注 0票数 0

你好,我目前尝试设置一个带有一些默认设置的ABP项目。我希望启用默认的聊天模块。我现在试过的..。

在FeatureConfigurator中启用它

代码语言:javascript
复制
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>();
        });
    }
}

但是,当我开始迁移时,我会得到以下异常:

代码语言:javascript
复制
define the Volo.Abp.GlobalFeatures.GlobalFeatureNameAttribute atttribute!

在DataSeed中启用它

代码语言:javascript
复制
_featureManager.SetForTenantAsync(tenantId, FeatureNameConstants.Chat, "True");

但是,当我开始迁移时,我会得到以下异常

代码语言:javascript
复制
The Chat Module is not Enabled

在没有UI交互的情况下,如何在第一次迁移中启用特性?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-07 08:09:52

最后,我想出了如何启用默认特性。也许这能帮到别人..。

如上面所示,只对CMS特性使用GlobalFeatureManager。例如,在FeatureManager类中注入SaasDataSeedContributer

代码语言:javascript
复制
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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72460040

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档