Lyo.Config.Postgres 1.0.1

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

Lyo.Config.Postgres

PostgreSQL + EF Core implementation of Lyo.Config.IConfigStore for storing typed configuration definitions and per-entity bindings.

What ships

  • ConfigDbContext (+ ConfigDbContextFactory) under Database/ with DbSet<ConfigDefinitionEntity>, DbSet<ConfigBindingEntity>, and DbSet<ConfigBindingRevisionEntity>.
  • Fluent-API entity configurations enforcing the uniqueness rules from Lyo.Config:
  • config_definition unique on (ForEntityType, Key).
  • config_binding unique on (DefinitionId, ForEntityType, ForEntityId) with ON DELETE CASCADE from the definition row.
  • config_binding_revision keyed on (BindingId, Revision) — monotonic 1-based revision numbers per binding.
  • PostgresConfigStore, the singleton IConfigStore implementation backed by an IDbContextFactory<ConfigDbContext>. It also implements Lyo.Health.IHealth so the container can be probed for relational connectivity.
  • PostgresConfigOptions (SectionName = "PostgresConfig", Schema = "config", ConnectionString, EnableAutoMigrations).
  • Migrations under Migrations/ (InitialCreate baseline) using the config schema for the EF migrations history table.

DI registration (Extensions)

All entry points are exposed as IServiceCollection extensions:

Entry point What it does
AddConfigDbContextFactory(Action<PostgresConfigOptions>) Registers IOptions<PostgresConfigOptions>, AddPostgresMigrations<ConfigDbContext, PostgresConfigOptions>(), and IDbContextFactory<ConfigDbContext> (UseNpgsql + migrations history under the configured schema). DbContext only — does not register IConfigStore.
AddConfigDbContextFactoryFromConfiguration(IConfiguration, string sectionName = PostgresConfigOptions.SectionName) Same as above; binds from the configuration section (default "PostgresConfig").
AddConfigDbContextFactory(PostgresConfigOptions options) Same as above with a pre-built options instance.
AddPostgresConfigStore(Action<PostgresConfigOptions>) Calls AddConfigDbContextFactory(...) then registers IConfigStore → singleton PostgresConfigStore.
AddPostgresConfigStoreFromConfiguration(IConfiguration, string sectionName = PostgresConfigOptions.SectionName) Same as above; binds from configuration.
AddPostgresConfigStore(PostgresConfigOptions options) Same as above with a pre-built options instance — for tests / integration harnesses.

PostgresConfigOptions.ConnectionString is validated (non-empty) by all entry points. The EnableAutoMigrations flag is consumed by AddPostgresMigrations<> — see Lyo.Postgres — to gate the hosted-startup migration runner.

Runtime expectations

PostgresConfigStore opens a fresh ConfigDbContext per call via the registered IDbContextFactory<ConfigDbContext>, so it is safe as a singleton under concurrent load. SaveBindingAsync writes the current value to config_binding and appends a new config_binding_revision row inside the same SaveChangesAsync, so revision history stays in lock-step with the latest binding value. The seeded initial migration writes revision 1 from each existing binding so history starts at deploy time.

Tenancy

Bindings (and their revisions) carry a nullable tenant_id column; definitions do not — schema is deployment-global. The config_binding unique constraint includes tenant_id, so the same definition can be bound per tenant without collision. Filtered tenant indexes (ix_config_binding_tenant, ix_config_binding_revision_tenant) back lookups.

IConfigStore binding methods (not definition methods) accept an explicit Guid? tenantId and run it through TenancyResolver.Resolve using the policy configured in PostgresConfigOptions.Tenancy (inheriting from EntityRefOptions.Mode when unset):

  • SystemOnly — bindings are persisted with tenant_id = NULL.
  • SingleTenantDefault (default) — caller value, falling back to Tenancy.DefaultTenantId then EntityRefOptions.DefaultTenantId.
  • MultiTenantStrict — caller must supply a non-empty tenantId or the store throws.

See Lyo.EntityReference.Postgres for the full matrix.

{
  "PostgresConfig": {
    "ConnectionString": "Host=localhost;Database=config;...",
    "Tenancy": { "Mode": "MultiTenantStrict" }
  }
}

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Config — (direct, lyo)
  • Lyo.EntityReference.Models — (direct, lyo)
  • Lyo.EntityReference.Postgres — (direct, lyo)
  • Lyo.Health — (direct, lyo)
  • Lyo.Postgres — (direct, lyo)
  • Microsoft.EntityFrameworkCore 10.0.5 — (direct, microsoft)
  • Microsoft.EntityFrameworkCore.Design 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 — (direct, microsoft)
  • Lyo.Common — (transitive, lyo)
  • Lyo.Exceptions — (transitive, lyo)
  • Microsoft.EntityFrameworkCore.Relational 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 — (transitive, microsoft)
  • Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3 — (transitive, third-party)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 — (transitive, microsoft, netstandard2.0)
Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Lyo.Config.Postgres:

Package Downloads
Lyo.Config.Api

Central HTTP API exposing Lyo.Config PostgreSQL-backed IConfigStore for microservices (polling-friendly ETags). Embed via AddConfigApi / MapConfigApiEndpoints.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 0 8/18/2026
1.0.0 55 8/16/2026