feat: 完善配置模块
This commit is contained in:
@@ -16,10 +16,10 @@ public class SettingAggregateRoot : Entity<Guid>, IAggregateRoot<Guid>
|
||||
public virtual string Value { get; internal set; }
|
||||
|
||||
[CanBeNull]
|
||||
public virtual string ProviderName { get; protected set; }
|
||||
public virtual string? ProviderName { get; protected set; }
|
||||
|
||||
[CanBeNull]
|
||||
public virtual string ProviderKey { get; protected set; }
|
||||
public virtual string? ProviderKey { get; protected set; }
|
||||
|
||||
public SettingAggregateRoot()
|
||||
{
|
||||
|
||||
@@ -145,15 +145,18 @@ namespace Yi.Abp.Application.Services
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetSettingAsync()
|
||||
{
|
||||
//DDD需要提前定义
|
||||
//默认来说,不提供修改操作,配置应该独立
|
||||
var enableOrNull = await _settingProvider.GetOrNullAsync("abp.ddd.enable");
|
||||
var enableOrNull = await _settingProvider.GetOrNullAsync("DDD");
|
||||
|
||||
//如果要进行修改,可使用yi.framework下的ISettingManager
|
||||
await _settingManager.SetAsync("abp.ddd.enable", "false", "系统", "admin");
|
||||
await _settingManager.SetGlobalAsync("DDD", "false");
|
||||
|
||||
var enableOrNull2 = await _settingProvider.GetOrNullAsync("abp.ddd.enable");
|
||||
var enableOrNull2 = await _settingManager.GetOrNullGlobalAsync("DDD");
|
||||
|
||||
return enableOrNull2 ?? string.Empty;
|
||||
//当然,他的独特地方,是支持来自多个模块,例如配置文件?
|
||||
var result= await _settingManager.GetOrNullConfigurationAsync("Test");
|
||||
return result ?? string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Settings;
|
||||
|
||||
namespace Yi.Abp.Domain.Shared.Settings
|
||||
{
|
||||
internal class TestSettingProvider : SettingDefinitionProvider
|
||||
{
|
||||
public override void Define(ISettingDefinitionContext context)
|
||||
{
|
||||
context.Add(
|
||||
new SettingDefinition("DDD","127.0.0.1"),
|
||||
new SettingDefinition("TTT", "127.0.0.1")
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,10 @@
|
||||
"SelfUrl": "http://*:19001",
|
||||
"CorsOrigins": "http://localhost:19001;http://localhost:18000"
|
||||
},
|
||||
|
||||
//配置
|
||||
"Settings": {
|
||||
"Test": "hello"
|
||||
},
|
||||
//数据库类型列表
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user