Raycynix.Extensions.Database.Abstractions 3.0.0

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

Raycynix.Extensions.Database.Abstractions

Contracts and configuration models shared by the Raycynix database packages.

What It Provides

  • DatabaseOptions and ConnectionOptions
  • IDatabaseBuilder
  • IDatabaseInitializer
  • IDatabaseProviderRegistration
  • IDatabaseModelAssemblyRegistry
  • IDatabaseObservability
  • IConfigurator and IGenericConfigurator<T>
  • DatabaseTableAttribute

Provider Contracts

Provider packages implement IDatabaseProviderRegistration to validate provider-specific settings, resolve a connection string, and configure EF Core provider options.

public interface IDatabaseProviderRegistration
{
    string ProviderName { get; }

    void Validate(DatabaseOptions configuration);

    string ResolveConnectionString(
        DatabaseOptions configuration,
        IServiceProvider serviceProvider);

    void Configure(
        DbContextOptionsBuilder options,
        string connectionString,
        DatabaseOptions configuration,
        Assembly migrationsAssembly,
        IServiceProvider serviceProvider);
}

Common validation stays in DatabaseOptions. Provider-specific rules, such as whether Host or Username is required, belong in the provider implementation.

Configurators

Reusable packages can contribute EF Core mappings through configurators:

[DatabaseTable("orders")]
public sealed class OrderConfigurator : IGenericConfigurator<Order>
{
    public Type Type => typeof(Order);

    public Type[] DependsOn => [];

    public string ModelCacheKey => typeof(Order).FullName!;

    public void Configure(ModelBuilder modelBuilder)
    {
        var entity = modelBuilder.Entity<Order>();
        entity.ToTable("orders");
        entity.HasKey(static order => order.Id);
    }

    public void Seed(ModelBuilder modelBuilder)
    {
    }
}

If a configurator changes the model shape from runtime values, include those values in ModelCacheKey so EF Core does not reuse an incompatible cached model.

Usage

This package is intended for provider packages, optional feature packages, and reusable modules that need database contracts without depending on the core runtime registration package.

Migrating From 2.x

  • DatabaseConfiguration is now DatabaseOptions.
  • ConnectionConfiguration is now ConnectionOptions.
  • Both types are available from Raycynix.Extensions.Database.Abstractions.Options.
  • Connection properties are now settable from registration callbacks as well as configuration binding.
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 (8)

Showing the top 5 NuGet packages that depend on Raycynix.Extensions.Database.Abstractions:

Package Downloads
Raycynix.Extensions.Database

Core Raycynix EF Core infrastructure with typed DatabaseOptions, shared and custom DbContext registration, provider validation, initialization, and model discovery.

Raycynix.Extensions.Database.Hosting

Generic host integration for validated Raycynix database creation and migration initialization through IDatabaseInitializer.

Raycynix.Extensions.Database.PostgreSql

PostgreSQL EF Core integration with typed PostgreSqlOptions, validated pooling, Npgsql connection-string composition, retries, and migrations.

Raycynix.Extensions.Database.MySql

MySQL EF Core integration with typed MySqlOptions, validated timeouts, connection-string composition, pooling, retries, and migrations.

Raycynix.Extensions.Database.Sqlite

SQLite EF Core integration with typed SqliteOptions, validated mode and cache settings, connection-string composition, and migrations.

GitHub repositories

This package is not used by any popular GitHub repositories.

v3.0.0 renames database configuration contracts to DatabaseOptions and ConnectionOptions, moves them to the Options namespace, and makes connection settings mutable from setup callbacks.