Choose SQL Server or PostgreSQL
Keep the same SqlOS host registration and switch only the EF Core provider line, plus the Aspire database resource in samples.
SqlOS ships one package. Hosts keep AddSqlOS<TContext>(db => db.UseSqlServer(...)) or switch that callback to UseNpgsql(...). Startup then loads the matching schema, function, and lock pack. Do not invent a second options model, dashboard switch, or NuGet package for the provider.
| Provider | EF registration | Locks | Schema pack |
|---|---|---|---|
| SQL Server | UseSqlServer(connectionString) | sp_getapplock | T-SQL scripts, dbo |
| PostgreSQL | UseNpgsql(connectionString) | Transaction-scoped advisory locks | PostgreSQL scripts, still dbo |
Unknown relational providers fail closed with an InvalidOperationException that names UseSqlServer and UseNpgsql. In-memory and other non-relational providers skip application locks.
MySQL and SQLite are not supported.
dbo. On PostgreSQL, SqlOS creates that schema if needed so hosts only change the EF provider line.citext or other extra modules.pg_advisory_xact_lock with a timeout. Hold an active transaction, the same way SQL Server application locks require one.COLLATE "C" where SQL Server used Latin1_General_100_BIN2.timestamp (no time zone), matching SQL Server datetime2. Store UTC DateTime values. SqlOS enables Npgsql's EnableLegacyTimestampBehavior AppContext switch only when the application DbContext is configured with UseNpgsql. The switch is process-wide and must be set before the first Npgsql type mapping is compiled. Inherit SqlOSDbContext<TContext> or call UseSqlOS with the PostgreSQL provider name so SqlOS can set it; AddSqlOS does not enable the switch for SQL Server hosts. UseSqlOS remaps only SqlOS-owned DateTime columns. If the same process already maps host DateTime properties to timestamptz, keep those mappings explicit.The Todo AppHost defaults to PostgreSQL and UseNpgsql. Set SqlOS:DatabaseProvider=SqlServer to start SQL Server instead.
dotnet run --project examples/SqlOS.Todo.AppHost
dotnet run --project examples/SqlOS.Todo.AppHost -- --SqlOS:DatabaseProvider=SqlServerPlaywright coverage for the Postgres path lives in examples/SqlOS.Todo.E2eTests and scripts/todo-e2e.sh.
See Run the Todo sample.