Base solution for your next web application
Open Closed

Use specific database for unique tenant #7765


User avatar
0
direccionti created

Hi!

I need to use a single connectionstring for one of the tenants. The rest of tenants would use the default connectionstring.

Example appsettings: "ConnectionStrings": {    "Default": " .......",    "Pruebas": " ......" },

I have a tenant called "Pruebas" and I want him to use a separate database to the other tenants. I have seen the documentation and searched for demos but I can't find a way to solve it.

https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy

Thanks for you help!


3 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi @direccionti,

    You can specific the database setting for a tenant during tenant creation time.

    When we create a new tenant, we should select/create a database to store new tenant's data. We can select 'Use host database' to store tenant data in host database (can be used for single database approach) or we can specify a connection string to create/use a dedicated database for new tenant. ASP.NET Zero supports hybrid approach. That means you can use host database for some tenants and create dedicated databases for some other tenants. Even you can group some tenants in a separated database.

    See https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Features-Angular-Tenant-Management

    If you want to change the database setting for existing tenant without going through the UI, you can update tenant setting in the database directly.

  • User Avatar
    0
    maliming created
    Support Team

    You can set its connection string when creating a tenant.

    When we create a new tenant, we should select/create a database to store new tenant's data. We can select 'Use host database' to store tenant data in host database (can be used for single database approach) or we can specify a connection string to create/use a dedicated database for new tenant. ASP.NET Zero supports hybrid approach. That means you can use host database for some tenants and create dedicated databases for some other tenants. Even you can group some tenants in a separated database.

    https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Features-Mvc-Core-Tenant-Management

  • User Avatar
    0
    direccionti created

    Hi!

    Thanks!