-
Notifications
You must be signed in to change notification settings - Fork 19
Queries accross multiple databases
Pawel Gerr edited this page Nov 11, 2025
·
1 revision
Enables executing queries across multiple databases.
Implement the interfaces ITenantDatabaseProviderFactory and ITenantDatabaseProvider which provide the current tenant (a string) and the database names for provided table name and schema.
Please note: the database names must not change for the same tenant! The implementation of the
ITenantDatabaseProviderFactorymust be designed so it can be registered as a singleton.
var services = new ServiceCollection()
.AddDbContext<DemoDbContext>(builder => builder
.UseSqlServer("conn-string",
options => options.AddTenantDatabaseSupport<DemoTenantDatabaseProviderFactory>());- Collection Parameters (temp-tables light) (SQL Server)
- Window Functions Support (RowNumber, Sum, Average, Min, Max)
- Nested (virtual) Transactions
- Table Hints (SQL Server)
- Queries accross multiple databases (SQL Server)
- Changing default schema at runtime
- If-Exists / If-Not-Exists checks in migrations (SQL Server)
- Migrations: include-columns (SQL Server)
- Migrations: identity column (SQL Server)
- Migrations: (non-)clustered PK (SQL Server)