dotnet / dotnet/EntityFramework.Docs
Scaling SaaS model (one DbContext, database-per-tenant) with EF Core?
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
There doesn't seem to be any good guidance on how to set up and maintain a database-per-tenant model for EF Core.
- How to create/ migrate new tenant dbs programmatically?
- How to manage connection strings?
- How to select a specific tenant at runtime?
Sharding seemed to be supported in .NET 4.x but no support in .NET Core or beyond. How is EF Core used in a scalable, sustainable manner in a SaaS environment with tenant data isolation?
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: bb29a2b6-c401-287f-2da9-1aeb3c633b41
* Version Independent ID: bb29a2b6-c401-287f-2da9-1aeb3c633b41
* Content: [Multi-tenancy - EF Core](https://docs.microsoft.com/en-US/ef/core/miscellaneous/multitenancy)
* Content Source: [entity-framework/core/miscellaneous/multitenancy.md](https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/miscellaneous/multitenancy.md)
* Product: **entity-framework**
* Technology: **entity-framework-core**
* GitHub Login: @JeremyLikness
* Microsoft Alias: **jeliknes**
Contributor guide
Assessment
This issue has not been assessed yet.