Skip to content

How to add a tenant-aware database

Use this guide when you want to add another tenant-aware DbContext to the platform.

  • Define a new DbContext that uses tenant information from the current context.
  • Register it via the Persistence building block with the correct lifetime.
  • Add migrations to the migrations project and ensure they run per tenant.

Keep tenant resolution and connection string logic in shared infrastructure instead of inside the DbContext itself.