Spindle.Persistence.EFCore.SqlServer
0.2.1
dotnet add package Spindle.Persistence.EFCore.SqlServer --version 0.2.1
NuGet\Install-Package Spindle.Persistence.EFCore.SqlServer -Version 0.2.1
<PackageReference Include="Spindle.Persistence.EFCore.SqlServer" Version="0.2.1" />
<PackageVersion Include="Spindle.Persistence.EFCore.SqlServer" Version="0.2.1" />
<PackageReference Include="Spindle.Persistence.EFCore.SqlServer" />
paket add Spindle.Persistence.EFCore.SqlServer --version 0.2.1
#r "nuget: Spindle.Persistence.EFCore.SqlServer, 0.2.1"
#:package Spindle.Persistence.EFCore.SqlServer@0.2.1
#addin nuget:?package=Spindle.Persistence.EFCore.SqlServer&version=0.2.1
#tool nuget:?package=Spindle.Persistence.EFCore.SqlServer&version=0.2.1
Spindle.Persistence.EFCore
Entity Framework Core persistence for Spindle.Net. The relational model is shared by four provider packages, each of which contains its own migrations.
Install the provider package for your database, then register it before the Spindle runtime:
services.AddSpindleSqlite("Data Source=spindle.db");
services.AddSpindleWorker();
The available registrations are:
services.AddSpindleSqlite(sqliteConnectionString);
services.AddSpindlePostgreSql(postgreSqlConnectionString);
services.AddSpindleMySql(mySqlConnectionString);
services.AddSpindleSqlServer(sqlServerConnectionString);
All registrations also accept an optional Action<DbContextOptionsBuilder> that
runs after Spindle's provider defaults. Use it for application-specific EF Core
options, such as EnableSensitiveDataLogging() when that is appropriate for the
environment. SQL Server sensitive-data logging is disabled by default.
PostgreSQL and SQL Server additionally accept an optional schema. The schema is applied to Spindle's entity tables and migrations history table, and is created by generated migration SQL when needed:
services.AddSpindlePostgreSql(
postgreSqlConnectionString,
schema: "spindle",
configure: options => options.EnableDetailedErrors());
MySQL and SQLite do not expose schema parameters because their installed EF Core providers do not support EF Core schemas.
Create or migrate the schema during application startup using the normal EF Core APIs:
await using var scope = services.CreateAsyncScope();
var contextFactory = scope.ServiceProvider
.GetRequiredService<IDbContextFactory<SpindleDbContext>>();
await using var database = await contextFactory.CreateDbContextAsync();
await database.Database.MigrateAsync();
Managing migrations
The repository includes equivalent Bash and PowerShell helpers that run dotnet ef against the provider-specific projects:
./scripts/migrations.sh add all AddFlowPriority
./scripts/migrations.sh check all
./scripts/migrations.sh list sqlite
./scripts/migrations.sh script postgresql 0
./scripts/migrations.ps1 add all AddFlowPriority
./scripts/migrations.ps1 check all
./scripts/migrations.ps1 list sqlite
./scripts/migrations.ps1 script postgresql 0
Supported provider names are sqlite, postgresql, mysql, and sqlserver; all runs the command for every provider. Use remove <provider> --force in Bash or remove <provider> -Force in PowerShell only when a migration can be removed without checking a database. The script command accepts optional from-migration and to-migration arguments and writes SQL to standard output. Both scripts use net10.0 for design-time operations by default; set SPINDLE_EF_FRAMEWORK to override it. The add, check, list, and remove commands always use schema-neutral design-time models. To validate a PostgreSQL or SQL Server migration script for a non-default schema, set SPINDLE_EF_SCHEMA before using the script command. The marker and value are ignored by the MySQL and SQLite design-time factories.
| Product | Versions 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 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.SqlServer (>= 10.0.10)
- Spindle.Persistence.EFCore (>= 0.2.1)
-
net8.0
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.29)
- Spindle.Persistence.EFCore (>= 0.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.