Setting Management: 用于持久化设置Setting值

一、定义SettingManagementOptions,多个设置值提供者,(与Volo.Abp.Settings模块ISettingValueProvider区别??

 public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure(options =>
            {
                options.Providers.Add();
                options.Providers.Add();
                options.Providers.Add();
                options.Providers.Add();
            });
        }

  

1、实体  Setting : Entity, IAggregateRoot

 名称、值、提供名称(比如默认,全部,租户,用户),ProviderKey(可以租户Id,用户Id等)

2、服务

1、SettingStore,依赖ISettingManagementStore,获取设置值

2、ISettingManagementStore获取,设置,删除设置值,     依赖仓储ISettingRepository,分布式缓存IDistributedCache

3、ISettingManager,关联IOptions options, IServiceProvider serviceProvider, ISettingDefinitionManager settingDefinitionManager,

ISettingEncryptionService settingEncryptionService,遍历List得到

3、UI层

1、配置导航菜单

    Configure(options =>
            {
                options.MenuContributors.Add(new SettingManagementMainMenuContributor());
            });

 2、配置虚拟文件

   Configure(options =>
            {
                options.FileSets.AddEmbedded("Volo.Abp.SettingManagement.Web");
            });

  3、配置本地化

  Configure(options =>
            {
                options.Resources
                    .Add("en");
            });

            Configure(options =>
            {
                options.Resources
                    .Get()
                    .AddVirtualJson("/Localization/Resources/AbpSettingManagement");
            });

  菜单路径:/SettingManagement,Abp的UI模块暂没有完善好

 

三、测试

同一配置名,可根据默认(从settingDefinitionContext里的SettingDefinition设置),全局,不同用户,租户可获取不同的值

你可能感兴趣的:(Setting Management: 用于持久化设置Setting值)