Raycynix.Extensions.Database
1.0.0
dotnet add package Raycynix.Extensions.Database --version 1.0.0
NuGet\Install-Package Raycynix.Extensions.Database -Version 1.0.0
<PackageReference Include="Raycynix.Extensions.Database" Version="1.0.0" />
<PackageVersion Include="Raycynix.Extensions.Database" Version="1.0.0" />
<PackageReference Include="Raycynix.Extensions.Database" />
paket add Raycynix.Extensions.Database --version 1.0.0
#r "nuget: Raycynix.Extensions.Database, 1.0.0"
#:package Raycynix.Extensions.Database@1.0.0
#addin nuget:?package=Raycynix.Extensions.Database&version=1.0.0
#tool nuget:?package=Raycynix.Extensions.Database&version=1.0.0
Raycynix.Extensions.Database
Raycynix.Extensions.Database is the core database package.
What it contains
AddRaycynixDatabase(...)AddRaycynixDatabaseAssembly(...)DatabaseBuilder.AddAssembly(...)DatabaseContextDatabaseConfiguration- provider registration infrastructure
IDatabaseInitializerDatabaseInitializer
What it does not contain
- PostgreSQL provider integration
- SQL Server provider integration
- MySQL provider integration
- SQLite provider integration
WebApplicationextensions- ASP.NET Core startup integration
- generic-host startup integration
Usage
builder.Services.AddRaycynixDatabase(builder.Configuration, options =>
{
options.UseMigrations = true;
});
appsettings.json
Core settings stay under DatabaseConfiguration:
{
"DatabaseConfiguration": {
"ConnectionString": "Host=localhost;Port=5432;Database=app;Username=app;Password=secret",
"UseMigrations": true,
"EnsureCreated": false,
"EnableSeed": true,
"EnableLazyLoading": false,
"EnableAutoDetectChanges": true,
"UseQueryTrackingByDefault": true,
"RetryCount": 5,
"RetryDelaySeconds": 10
}
}
Then add exactly one provider package and extend the registration:
builder.Services
.AddRaycynixDatabase(builder.Configuration, options =>
{
options.UseMigrations = true;
})
.AddPostgreSql();
Equivalent provider packages expose:
AddPostgreSql()AddMsSql()AddMySql()AddSqlite()
The provider package is selected by registration, not by a legacy Provider configuration key.
Provider-specific settings remain nested under the same root section:
{
"DatabaseConfiguration": {
"PostgreSqlConfiguration": {
"Pooling": true,
"MinimumPoolSize": 5,
"MaximumPoolSize": 50,
"CommandTimeoutSeconds": 30,
"IncludeErrorDetail": false
}
}
}
If a reusable package contributes EF Core configurators to the shared DatabaseContext, register its assembly explicitly:
builder.Services.AddRaycynixDatabase(builder.Configuration)
.AddAssembly<SomePackageMarker>();
This keeps a single shared DatabaseContext while allowing infrastructure packages to extend the model without creating their own context.
By default, AddRaycynixDatabase(...) also registers the caller assembly for configurator discovery. This is convenient when the application's own configurators live next to the startup code.
If configurator assemblies should be controlled explicitly, disable caller-assembly registration and add the required assemblies yourself:
builder.Services
.AddRaycynixDatabase(builder.Configuration, registerCallerAssembly: false)
.AddPostgreSql()
.AddAssembly<IdentityModelMarker>()
.AddAssembly<AuditModelMarker>();
Use explicit assembly registration in tests, plugin-style architectures, or shared assemblies that contain configurators with optional dependencies.
Provider-specific packages extend the same fluent builder, and the core package expects exactly one database provider registration.
Table names can be configured in three ways, in this order:
- an explicit runtime name passed to
ConfigureEntity(modelBuilder, tableName) DatabaseTableAttributeon the configurator- the entity type name
For static table names, configurators can declare the default mapping with DatabaseTableAttribute instead of calling ToTable(...) manually inside Configure(...).
For runtime overrides, prefer injecting configuration into the configurator and passing the resolved name to ConfigureEntity(modelBuilder, tableName).
When a configurator changes the model shape at runtime, override GetModelShapeCacheKey() so EF Core does not reuse an incompatible cached model.
public sealed class OrdersDatabaseOptions
{
public string TableName { get; init; } = "orders";
}
public sealed class OrderConfigurator(
OrdersDatabaseOptions options) : GenericConfigurator<Order>
{
public override Type[] DependsOn => [];
public override void Configure(ModelBuilder modelBuilder)
{
var entity = ConfigureEntity(modelBuilder, options.TableName);
entity.HasKey(static current => current.Id);
}
protected override string? GetModelShapeCacheKey()
{
return options.TableName;
}
}
If you want an explicit fluent call, use modelBuilder.Entity<T>().EntityName(tableName).
If a configurator relies on runtime-dependent mappings such as table names, schemas, or provider-conditioned model shape, keep those values stable within a given service provider and include them in GetModelShapeCacheKey().
If you want to run initialization during startup, use one of these packages:
Raycynix.Extensions.Database.HostingRaycynix.Extensions.Database.AspNetCore
| 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. |
-
net10.0
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.5)
- Microsoft.Extensions.Configuration (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Raycynix.Extensions.Common (>= 1.0.0)
- Raycynix.Extensions.Configuration (>= 1.0.0)
- Raycynix.Extensions.Database.Abstractions (>= 1.0.0)
- Raycynix.Extensions.Logging (>= 1.0.0)
- Raycynix.Extensions.Metrics.Abstractions (>= 1.0.0)
- Raycynix.Extensions.Tracing.Abstractions (>= 1.0.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Raycynix.Extensions.Database:
| Package | Downloads |
|---|---|
|
Raycynix.Extensions.Messaging.Database
Database-backed messaging inbox and outbox persistence with ambient unit-of-work support, optimistic concurrency leasing, retention cleanup, and configuration-based setup on the shared Raycynix DatabaseContext. |
|
|
Raycynix.Extensions.Database.Hosting
Generic host startup integration for Raycynix database initialization through IDatabaseInitializer. |
|
|
Raycynix.Extensions.Database.MySql
MySQL provider integration for Raycynix.Extensions.Database with AddMySql registration, MySQL connection-string composition, and EF Core UseMySQL configuration. |
|
|
Raycynix.Extensions.Database.PostgreSql
PostgreSQL provider integration for Raycynix.Extensions.Database with AddPostgreSql registration, Npgsql connection-string composition, and EF Core UseNpgsql configuration. |
|
|
Raycynix.Extensions.Database.MsSql
SQL Server provider integration for Raycynix.Extensions.Database with AddMsSql registration, SQL Server connection-string composition, and EF Core UseSqlServer configuration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
See the repository changelog and release history for package-specific changes and breaking updates.