SettingConfig 1.1.0

dotnet add package SettingConfig --version 1.1.0
                    
NuGet\Install-Package SettingConfig -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SettingConfig" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SettingConfig" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SettingConfig" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SettingConfig --version 1.1.0
                    
#r "nuget: SettingConfig, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SettingConfig@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SettingConfig&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SettingConfig&version=1.1.0
                    
Install as a Cake Tool

title: SettingConfig lang: zh-CN date: 2024-04-11 publish: true author: azrng order: 40 category:

  • nuget tag:

Azrng.SettingConfig

该项目是一个业务配置维护的Nuget包

使用场景

安装该包后,通过简单对接数据库,就可以实现业务逻辑配置的数据库存储,支持页面修改、历史版本控制,代码中查询以及缓存处理。

接入方案

注入服务配置

var conn = builder.Configuration.GetConnectionString("pgsql");
builder.Services.AddSettingConfig(options =>
{
    options.DbConnectionString = conn;
    options.DbSchema = "sample";
    options.RoutePrefix = "configDashboard";
    options.ApiRoutePrefix = "/api/configDashboard";
});

使用Dashboard界面

app.UseSettingDashboard();

默认情况下启动项目访问 url/systemSetting进行访问

项目中如果需要查询配置信息进行注入服务IConfigExternalProvideService

var aa = await _configSettingService.GetConfigContentAsync("aaa");
// 或者
var aa = await _configSettingService.GetConfigAsync<List<string>>("aaa");

功能

  • 个性化配置

    • 页面标题设置
    • 页面路由设置
    • 页面加密访问
  • 系统配置界面

    • 列表展示

      • 配置名、配置key搜索

      • 版本筛选

      • 删除配置

    • 配置编辑

    • 历史配置

  • 存储

    • pgsql存储
  • 使用

    • 项目中查询
    • 查询缓存
    • 支持初始化数据

扩展

Basic认证

需要安装nuget包:Azrng.SettingConfig.BasicAuthorization ,然后

var conn = builder.Configuration.GetConnectionString("pgsql");
builder.Services.AddSettingConfig(options =>
{
    options.DbConnectionString = conn;
    options.DbSchema = "sample";
    options.RoutePrefix = "configDashboard";
    options.ApiRoutePrefix = "/api/configDashboard";
    options.Authorization = new[]
    {
        new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
        {
            RequireSsl = false,
            SslRedirect = false,
            LoginCaseSensitive = true,
            Users = new[] { new BasicAuthAuthorizationUser { Login = "admin", PasswordClear = "123456" } }
        })
    };
});
缓存扩展

该项目默认使用内存缓存进行存储,你可以自行继承接口来替换默认的缓存方案。

  • 1.0.0
    • 基本的Basic认证

版本更新记录

  • 1.1.0
    • 适配Azrng.Core1.2.1的修改
  • 1.0.1
    • 支持通过调用AddIfNotExistsAsync接口初始化数据
  • 1.0.0
    • 增加了历史版本配置的复制
    • 增加Basic认证方案
  • 0.0.1
    • 基本的配置更新
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SettingConfig:

Package Downloads
Azrng.SettingConfig.BasicAuthorization

SettingConfig的Basic认证扩展

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 105 8/9/2025
1.0.1 134 4/12/2024
1.0.0 136 4/11/2024
0.0.1 215 3/5/2023