From c95495e0732b031ccb12406b25591d5a3866d076 Mon Sep 17 00:00:00 2001 From: feijie Date: Tue, 10 Dec 2024 22:56:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(docs):=20=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=A8=A1=E5=9D=97=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../README.EN.md | 85 +++++++++++++++++++ .../README.md | 85 +++++++++++++++++++ .../LINGYUN.Abp.Settings/README.EN.md | 55 ++++++++++++ .../settings/LINGYUN.Abp.Settings/README.md | 55 ++++++++++++ 4 files changed, 280 insertions(+) create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.EN.md create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.md create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.EN.md create mode 100644 aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.md diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.EN.md b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.EN.md new file mode 100644 index 000000000..439936a55 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.EN.md @@ -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 + { + new UpdateSettingDto + { + Name = "SettingName", + Value = "NewValue" + } + } + }); + } +} +``` + +[Back to TOC](../../../README.md) diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.md b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/README.md new file mode 100644 index 000000000..91fc59f21 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.SettingManagement.Application.Contracts/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 + { + new UpdateSettingDto + { + Name = "SettingName", + Value = "NewValue" + } + } + }); + } +} +``` + +[返回目录](../../../README.md) diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.EN.md b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.EN.md new file mode 100644 index 000000000..99a86c26f --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.EN.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 GetSettingValueAsync(string name) + { + // Get setting value, returns default value if empty + return await _settingProvider.GetOrDefaultAsync(name, _serviceProvider); + } +} +``` + +[Back to TOC](../../../README.md) diff --git a/aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.md b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/README.md new file mode 100644 index 000000000..41b763009 --- /dev/null +++ b/aspnet-core/framework/settings/LINGYUN.Abp.Settings/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 GetSettingValueAsync(string name) + { + // 获取设置值,如果为空则返回默认值 + return await _settingProvider.GetOrDefaultAsync(name, _serviceProvider); + } +} +``` + +[返回目录](../../../README.md)