4 changed files with 280 additions and 0 deletions
@ -0,0 +1,85 @@ |
|||||
|
# LINGYUN.Abp.SettingManagement.Application.Contracts |
||||
|
|
||||
|
## Module Description |
||||
|
|
||||
|
Setting management application service contracts module, providing interface definitions and DTOs for setting management. |
||||
|
|
||||
|
### Base Modules |
||||
|
|
||||
|
* Volo.Abp.SettingManagement.Application.Contracts |
||||
|
* Volo.Abp.Ddd.Application.Contracts |
||||
|
|
||||
|
### Features |
||||
|
|
||||
|
* Provides setting management application service interfaces |
||||
|
* ISettingAppService - General setting management service |
||||
|
* IUserSettingAppService - User setting management service |
||||
|
* IReadonlySettingAppService - Read-only setting service |
||||
|
* Provides setting-related DTO definitions |
||||
|
* SettingGroupDto - Setting group DTO |
||||
|
* SettingDto - Setting DTO |
||||
|
* SettingDetailsDto - Setting details DTO |
||||
|
* UpdateSettingDto - Update setting DTO |
||||
|
* Provides setting management related permission definitions |
||||
|
|
||||
|
### Permissions |
||||
|
|
||||
|
* SettingManagement.ManageHostFeatures - Manage host features |
||||
|
* SettingManagement.ManageFeatures - Manage features |
||||
|
* SettingManagement.Settings - Setting management |
||||
|
* SettingManagement.Settings.Update - Update settings |
||||
|
* SettingManagement.Settings.ManageGroup - Manage setting groups |
||||
|
|
||||
|
### Configuration |
||||
|
|
||||
|
* SettingManagementMergeOptions |
||||
|
* EnableCustomize - Enable custom settings |
||||
|
* EnableHost - Enable host settings |
||||
|
* EnableTenant - Enable tenant settings |
||||
|
* EnableUser - Enable user settings |
||||
|
|
||||
|
### How to Use |
||||
|
|
||||
|
1. Add `AbpSettingManagementApplicationContractsModule` dependency |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpSettingManagementApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Inject and use setting services |
||||
|
|
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ISettingAppService _settingAppService; |
||||
|
|
||||
|
public YourService(ISettingAppService settingAppService) |
||||
|
{ |
||||
|
_settingAppService = settingAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task ManageSettingsAsync() |
||||
|
{ |
||||
|
// Get setting groups |
||||
|
var groups = await _settingAppService.GetAllGroupsAsync(); |
||||
|
|
||||
|
// Update settings |
||||
|
await _settingAppService.UpdateAsync("GroupName", new UpdateSettingsDto |
||||
|
{ |
||||
|
Settings = new List<UpdateSettingDto> |
||||
|
{ |
||||
|
new UpdateSettingDto |
||||
|
{ |
||||
|
Name = "SettingName", |
||||
|
Value = "NewValue" |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
[Back to TOC](../../../README.md) |
||||
@ -0,0 +1,85 @@ |
|||||
|
# LINGYUN.Abp.SettingManagement.Application.Contracts |
||||
|
|
||||
|
## 模块说明 |
||||
|
|
||||
|
设置管理应用服务契约模块,提供设置管理相关的接口定义和DTO。 |
||||
|
|
||||
|
### 基础模块 |
||||
|
|
||||
|
* Volo.Abp.SettingManagement.Application.Contracts |
||||
|
* Volo.Abp.Ddd.Application.Contracts |
||||
|
|
||||
|
### 功能定义 |
||||
|
|
||||
|
* 提供设置管理的应用服务接口定义 |
||||
|
* ISettingAppService - 通用设置管理服务 |
||||
|
* IUserSettingAppService - 用户设置管理服务 |
||||
|
* IReadonlySettingAppService - 只读设置服务 |
||||
|
* 提供设置相关的DTO定义 |
||||
|
* SettingGroupDto - 设置组DTO |
||||
|
* SettingDto - 设置DTO |
||||
|
* SettingDetailsDto - 设置详情DTO |
||||
|
* UpdateSettingDto - 更新设置DTO |
||||
|
* 提供设置管理相关的权限定义 |
||||
|
|
||||
|
### 权限定义 |
||||
|
|
||||
|
* SettingManagement.ManageHostFeatures - 管理主机功能 |
||||
|
* SettingManagement.ManageFeatures - 管理功能 |
||||
|
* SettingManagement.Settings - 设置管理 |
||||
|
* SettingManagement.Settings.Update - 更新设置 |
||||
|
* SettingManagement.Settings.ManageGroup - 管理设置组 |
||||
|
|
||||
|
### 配置定义 |
||||
|
|
||||
|
* SettingManagementMergeOptions |
||||
|
* EnableCustomize - 是否启用自定义设置 |
||||
|
* EnableHost - 是否启用主机设置 |
||||
|
* EnableTenant - 是否启用租户设置 |
||||
|
* EnableUser - 是否启用用户设置 |
||||
|
|
||||
|
### 如何使用 |
||||
|
|
||||
|
1. 添加 `AbpSettingManagementApplicationContractsModule` 依赖 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpSettingManagementApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 注入并使用设置服务 |
||||
|
|
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ISettingAppService _settingAppService; |
||||
|
|
||||
|
public YourService(ISettingAppService settingAppService) |
||||
|
{ |
||||
|
_settingAppService = settingAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task ManageSettingsAsync() |
||||
|
{ |
||||
|
// 获取设置组 |
||||
|
var groups = await _settingAppService.GetAllGroupsAsync(); |
||||
|
|
||||
|
// 更新设置 |
||||
|
await _settingAppService.UpdateAsync("GroupName", new UpdateSettingsDto |
||||
|
{ |
||||
|
Settings = new List<UpdateSettingDto> |
||||
|
{ |
||||
|
new UpdateSettingDto |
||||
|
{ |
||||
|
Name = "SettingName", |
||||
|
Value = "NewValue" |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
[返回目录](../../../README.md) |
||||
@ -0,0 +1,55 @@ |
|||||
|
# LINGYUN.Abp.Settings |
||||
|
|
||||
|
## Module Description |
||||
|
|
||||
|
ABP Settings Management extension module, providing additional settings management functionality. |
||||
|
|
||||
|
### Base Modules |
||||
|
|
||||
|
* Volo.Abp.Settings |
||||
|
|
||||
|
### Features |
||||
|
|
||||
|
* Extends the ISettingProvider interface, providing more convenient setting retrieval methods |
||||
|
* GetOrDefaultAsync - Get setting value, returns default value if empty |
||||
|
|
||||
|
### Configuration |
||||
|
|
||||
|
No special configuration items |
||||
|
|
||||
|
### How to Use |
||||
|
|
||||
|
1. Add module dependency |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpSettingsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use extension methods |
||||
|
|
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ISettingProvider _settingProvider; |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
public YourService( |
||||
|
ISettingProvider settingProvider, |
||||
|
IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_settingProvider = settingProvider; |
||||
|
_serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
public async Task<string> GetSettingValueAsync(string name) |
||||
|
{ |
||||
|
// Get setting value, returns default value if empty |
||||
|
return await _settingProvider.GetOrDefaultAsync(name, _serviceProvider); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
[Back to TOC](../../../README.md) |
||||
@ -0,0 +1,55 @@ |
|||||
|
# LINGYUN.Abp.Settings |
||||
|
|
||||
|
## 模块说明 |
||||
|
|
||||
|
ABP 设置管理扩展模块,提供了额外的设置管理功能。 |
||||
|
|
||||
|
### 基础模块 |
||||
|
|
||||
|
* Volo.Abp.Settings |
||||
|
|
||||
|
### 功能定义 |
||||
|
|
||||
|
* 扩展了 ISettingProvider 接口,提供了更多便利的设置获取方法 |
||||
|
* GetOrDefaultAsync - 获取设置值,如果为空则返回默认值 |
||||
|
|
||||
|
### 配置定义 |
||||
|
|
||||
|
无特殊配置项 |
||||
|
|
||||
|
### 如何使用 |
||||
|
|
||||
|
1. 添加模块依赖 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpSettingsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用扩展方法 |
||||
|
|
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ISettingProvider _settingProvider; |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
public YourService( |
||||
|
ISettingProvider settingProvider, |
||||
|
IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_settingProvider = settingProvider; |
||||
|
_serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
public async Task<string> GetSettingValueAsync(string name) |
||||
|
{ |
||||
|
// 获取设置值,如果为空则返回默认值 |
||||
|
return await _settingProvider.GetOrDefaultAsync(name, _serviceProvider); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
[返回目录](../../../README.md) |
||||
Loading…
Reference in new issue