添加配置管理功能,包括获取和设置配置值的接口及实现
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s

This commit is contained in:
孙诚
2026-01-05 15:21:13 +08:00
parent 5a824dac91
commit d44cceb6e4
8 changed files with 306 additions and 22 deletions

View File

@@ -0,0 +1,19 @@
namespace Repository;
public interface IConfigRepository : IBaseRepository<ConfigEntity>
{
/// <summary>
/// 根据Key获取配置
/// </summary>
Task<ConfigEntity?> GetByKeyAsync(string key);
}
public class ConfigRepository(IFreeSql freeSql) : BaseRepository<ConfigEntity>(freeSql), IConfigRepository
{
public async Task<ConfigEntity?> GetByKeyAsync(string key)
{
return await FreeSql.Select<ConfigEntity>()
.Where(c => c.Key == key)
.FirstAsync();
}
}