Aidan
Aidan

Reputation: 1

Abp.io: 'Out of the box' Multi Tenancy - Fails to Connect - Separate SQL Database Connection String for each Tenant

I thought I'd try out the standard layered ASP.NET Core 3.1 Abp.io template available at: https://Abp.io

I've followed the setup instructions, running the migration scripts to create the host database in localdb, and am able to successfully load the UI.

I login with the default credentials, then I create a new Tenant under 'Tenant Management' in the UI. I specify a custom database connection string for that tenant.

I open SQL Server Management Studio and create an empty database matching this in localdb.

Next, I logout of the admin host user, then press 'switch tenant' and type in the tenant name I just created. It gets stuck on loading, and there's a bunch of SQL Exceptions, then finally it gives up and shows the unable to connect error.

What steps do I need to take to setup a separate database for a tenant? Are there any migration scripts I need to run after creating the empty database?

Upvotes: 0

Views: 831

Answers (1)

Sean
Sean

Reputation: 145

@Aidan, I think you need to run the DbMigrator again after creating a new Tenant using a newly introduced connection string. The migration tool should traverse the tenancy connection strings a apply the latest migration. Then you should be able to utilize the new Tenant. Hope that helps.

Upvotes: 0

Related Questions