Skip to content

Sharding: Move Tenant to database

Jon P Smith edited this page Aug 23, 2022 · 3 revisions

There is only one extra Tenant Admin command when you are using many-databases structure (e.g. when the TenantType property in the AuthP options has the AddSharding member added) is the MoveToDifferentDatabaseAsync. This method does two things:

  • It can move the tenant's data to another database, defined by the connection string names.
  • It can change the tenant's HasOwnDb property, which will change whether the tenant has its own database or not. Note the you can just changed the HasOwnDb property, then it changes the database arrangement.

See Moving a hierarchical Tenant for a useful diagram showing what happens in a hierarchical tenant move.

The method is easy to use, but be aware implementing the code your tenant change service is quite difficult. See the MoveToDifferentDatabaseAsync implementation in the ShardingTenantChangeService

Articles / Videos

Concepts

Setup

Usage

Admin

SupportCode

Clone this wiki locally