Imato.ConfigurationProvider.SqlServer
1.0.4
dotnet add package Imato.ConfigurationProvider.SqlServer --version 1.0.4
NuGet\Install-Package Imato.ConfigurationProvider.SqlServer -Version 1.0.4
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="Imato.ConfigurationProvider.SqlServer" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Imato.ConfigurationProvider.SqlServer" Version="1.0.4" />
<PackageReference Include="Imato.ConfigurationProvider.SqlServer" />
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 Imato.ConfigurationProvider.SqlServer --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Imato.ConfigurationProvider.SqlServer, 1.0.4"
#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 Imato.ConfigurationProvider.SqlServer@1.0.4
#: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=Imato.ConfigurationProvider.SqlServer&version=1.0.4
#tool nuget:?package=Imato.ConfigurationProvider.SqlServer&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Imato.ConfigurationProvider.SqlServer
Setup
Add startup configuration
var builder = Host.CreateApplicationBuilder(args);
builder.Configuration.AddSqlConfigurations(c =>
{
// Connection name in Configurations to configuration DB.
// Try to use Env variable like ConnectionStrings__Configurations.
// Default value: "Configurations"
c.ConnectionStringName = "Configurations";
// Or use your connection string
c.ConnectionString = "";
// Table for configuration store. Default value: "Configurations"
c.TableName = "Configurations";
// Table sachem for configuration store. Default value: "dbo"
c.SchemaName = "dbo";
// Update options interval. Default: 5 min
c.RefreshInterval = TimeSpan.FromMinutes(5);
// App name in configuration table. Default: current package id
c.AppName = Assembly.GetEntryAssembly()?.GetName().Name;
//.NET CORE Environment name from ASPNETCORE_ENVIRONMENT. Default: "Development"
c.EnvironmentName = "Development";
// Save your new local appsettings configuration keys into DB on start. Default: false
c.SyncLocalConfigsToDb = true;
});
and your table TableName from connection ConnectionStringName will be saved and updated every RefreshInterval in IConfiguration.
Table will be created in startup process. Your user should be have permision for create new Table in DB.
Using
Just get option from DB table in IConfiguration.
appsettings.json
{
"Test1": {
"Foo": "ddff",
"Bar": 4
}
}
public record Test1(string Foo, int Bar);
var value = configureation.GetValueOf<Test1>();
Console.WriteLine($"Test1: {JsonSerializer.Serialize(value)}");
You can update, save same konfiguration key in table
var provider = configureation.GetConfigurationProvider<SqlConfigurationProvider>();
provider.Set("Test1:Bar", (value.Bar + 1).ToString());
// OR
configuration.SetValue("Test1:Bar", (value.Bar + 1).ToString());
Manual update value in table
update dbo.Configurations
set Value = '500'
where [Key] = 'Test1:Bar'
and App = 'Imato.TestApp'
and Environment = 'Development';
Table track changes: previous value and user name
select *
from dbo.Configurations
where [Key] = 'Test1:Bar'
and App = 'Imato.TestApp'
and Environment = 'Development';
Id App Environment Key Value PrevValue UpdateDate UpdateUser
2 Imato.TestApp Development Test1:Bar 509 508 2026-06-04 14:53:18.6911166 +03:00 test_user
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- AsyncKeyedLock (>= 8.0.2)
- Microsoft.Data.SqlClient (>= 7.0.1)
- Microsoft.Extensions.Configuration (>= 10.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Ready to use