Finbuckle / Finbuckle.MultiTenant

Finbuckle.MultiTenant is an open-source multitenancy middleware library for .NET. It enables tenant resolution, per-tenant app behavior, and per-tenant data isolation.
https://www.finbuckle.com/multitenant
Apache License 2.0
1.33k stars 266 forks source link

Creating a tenant is not creating a database for it #645

Open hamedwiz opened 1 year ago

hamedwiz commented 1 year ago

I'm using separate multi-tenant databases, but when I create a multi tenant using IMultiTenant Store and using the TryAdd() method it creates the row in table Tenants but it doesn't create a database for the tenant itself although I'm adding a connection string when creating it.

AndrewTriesToCode commented 1 year ago

Hello, The library will not actually create databases for you -- TryAdd is to add a tenant to the existing tenant store database not the database itself. For now the responsibility of creating the databases is up the your application or external processes.

You can use {dbContext}.Database.EnsureCreated() in your code to programmatically create the database if needed.