Imato.ConfigurationProvider.SqlServer
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Imato.ConfigurationProvider.SqlServer --version 1.0.2
NuGet\Install-Package Imato.ConfigurationProvider.SqlServer -Version 1.0.2
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.2" />
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.2" />
<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.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Imato.ConfigurationProvider.SqlServer, 1.0.2"
#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.2
#: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.2
#tool nuget:?package=Imato.ConfigurationProvider.SqlServer&version=1.0.2
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 =>
{
c.ConnectionStringName = "Configurations"; // Connection name in Configurations to configuration DB. Default value: "Configurations"
c.ConnectionString = "or your connection string";
c.TableName = "dbo.Configurations"; // Table for configuration store. Default value: "dbo.Configurations"
c.RefreshInterval = TimeSpan.FromMinutes(5); // Update options interval. Default: 5 min
c.AppName = Assembly.GetEntryAssembly()?.GetName().Name; // App name in configuration table. Default: current package id
c.EnvironmentName = "Development"; //.NET CORE Environment name from ASPNETCORE_ENVIRONMENT. Default: "Development"
c.SyncLocalConfigsToDb = true; // Save yours local appsettings configuration into DB on start.Default: false
});
and your table TableName from connection ConnectionStringName will be saved and updated every RefreshInterval in IConfiguration.
Using
Just get option from DB table in IConfiguration.
public record Test1(string Foo, int Bar);
var value = configureation.GetValueOf<Test1>();
Console.WriteLine($"Test1: {JsonSerializer.Serialize(value)}");
| 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
- 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