RAIC.Extensions.Configuration.EntityFrameworkCore 0.1.1

dotnet add package RAIC.Extensions.Configuration.EntityFrameworkCore --version 0.1.1
                    
NuGet\Install-Package RAIC.Extensions.Configuration.EntityFrameworkCore -Version 0.1.1
                    
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="RAIC.Extensions.Configuration.EntityFrameworkCore" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RAIC.Extensions.Configuration.EntityFrameworkCore" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="RAIC.Extensions.Configuration.EntityFrameworkCore" />
                    
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 RAIC.Extensions.Configuration.EntityFrameworkCore --version 0.1.1
                    
#r "nuget: RAIC.Extensions.Configuration.EntityFrameworkCore, 0.1.1"
                    
#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 RAIC.Extensions.Configuration.EntityFrameworkCore@0.1.1
                    
#: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=RAIC.Extensions.Configuration.EntityFrameworkCore&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=RAIC.Extensions.Configuration.EntityFrameworkCore&version=0.1.1
                    
Install as a Cake Tool

RAIC.Extensions.Configuration.EntityFrameworkCore

This library is a Microsoft.Extensions.Configuration.IConfigurationProvider that reads settings from a DbSet<ISetting> Settings property present on your Entity Framework Core DbContext.

Goals

  1. Usable with minimal constraints on your entity model
  2. Follows conventional configuration patterns
  3. IOptionsMonitor update support through optional opt-in services (see RAIC.Extensions.Configuration.EntityFrameworkCore.PostgreSQL & RAIC.Extensions.Configuration.EntityFrameworkCore.SqlServer)

Requirements

  • .NET 8

Gotchas

  • Setting values cannot be null (as signified by the RequiredAttribute on ISetting.Value)
  • Setting keys should not contain the = character (similar to CommandLineConfigurationProvider & EnvironmentVariablesConfigurationProvider)

Usage Example


using RAIC.Extensions.Configuration.EntityFrameworkCore.Extensions;

public record Setting : ISetting
{
    [Key]
    public required string Key { get; set; }

    [Required]
    public required string Value { get; set; }
}

public class MyDbContext(DbContextOptions<MyDbContext> options) : DbContext(options), ISettingsDbContext<DbSet<Setting>>, ISettingsDbContextFactory<MyDbContext>
{
    public DbSet<Setting> Settings { get; set; }

    public static MyDbContext Create(DbContextOptions<MyDbContext> options) => new(options);
}

var builder =  Host.CreateApplicationBuilder(args) // or  WebApplication.CreateBuilder(args); 

// build an initial configuration
builder.Configuration.AddJsonFile("appsettings.json")
                     ...
                     .AddUserSecrets<Program>(); // or whereever your connection string lives

// obtain connection string from preliminary config so can initialise other settings from DbContext
builder.Configuration.AddDbContext<MyDbContext>(dbContextOptions => dbContextOptions.UseNpgsql(builder.Configuration.GetConnectionString("Default")));

...

await builder.Build().RunAsync(); // use config as normal

Read more about Configuration on the Microsoft Docs site.

Product Compatible and additional computed target framework versions.
.NET 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 (2)

Showing the top 2 NuGet packages that depend on RAIC.Extensions.Configuration.EntityFrameworkCore:

Package Downloads
RAIC.Extensions.Configuration.EntityFrameworkCore.SqlServer

Adds "reload on change" support to RAIC.Extensions.Configuration.EntityFrameworkCore for Microsoft SQL Server

RAIC.Extensions.Configuration.EntityFrameworkCore.PostgreSQL

Adds "reload on change" support to RAIC.Extensions.Configuration.EntityFrameworkCore for PostgreSQL

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 136 1/7/2026
0.0.1 252 12/7/2025