Using the LocalDatabase provider mode
When you run MobilityManager locally through the Aspire AppHost, the LocalDatabase:Provider setting controls how the development database is provisioned. This is separate from the runtime DatabaseProvider setting and only applies to the AppHost orchestration used during development.
What LocalDatabase:Provider does
The AppHost reads LocalDatabase:Provider to decide whether to start a managed database container for you:
- PostgreSQL (default) — the AppHost starts a PostgreSQL resource and creates two databases, wiring them to the
SystemConnectionandTenantConnectionnames automatically. - SqlServer — the AppHost does not provision a database. The API keeps using your own external or locally installed SQL Server through the connection strings you supply.
Any other value throws an Unsupported LocalDatabase:Provider error listing the supported values.
Note: The default AppHost mode is PostgreSQL, which is the recommended local option on ARM-based machines. The setting lives in
src/CK.MobilityManager.AppHost/appsettings.Development.json.
Running in PostgreSQL mode
In PostgreSQL mode the AppHost provisions the databases mobilitymanager_system and mobilitymanager_tenant, sets DatabaseProvider=PostgreSQL on the API, and waits for the databases before starting. Provide a password for the PostgreSQL parameter, then run the AppHost:
$env:Parameters__postgres-password="DevPassword123!"
dotnet run --project src/CK.MobilityManager.AppHost
Startup, onboarding, and tenant provisioning apply normal EF Core migrations on PostgreSQL just as they do on SQL Server.
Running in SQL Server mode
To keep using a locally managed SQL Server instance, override the provider:
$env:LocalDatabase__Provider="SqlServer"
dotnet run --project src/CK.MobilityManager.AppHost
In this mode you are responsible for the SQL Server instance and for supplying the SystemConnection and TenantConnection strings the API uses.
Tip: Environment variables use the double-underscore separator to represent nested keys, so
LocalDatabase__Providermaps to theLocalDatabase:Providerconfiguration value.
How it relates to production
The LocalDatabase:Provider switch is a development convenience for the Aspire AppHost only. In Docker Compose, Kubernetes, or a published deployment there is no AppHost: you set the runtime DatabaseProvider directly and point the connection strings at your own managed databases. The AppHost and Docker Compose both use SystemConnection and TenantConnection as the canonical connection string names.
Related
- Prerequisites for building and running the platform
- Choosing between PostgreSQL and SQL Server
- Configuring the database connection strings
- Running the platform with Docker Compose for development