Base solution for your next web application
Open Closed

Creating separate database per tenant in Azure Elastic Pool #9796


User avatar
0
omkarchoudhari created

product version .NET Core and Angular 9.2.1

  • Angular
  • .net core)

I have a Query regarding tenant database creation on Azure elastic pools :

In current template 8.9 , When we create a new tenant with separate database option, its DB get created using following method

_abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);

As this method is present in library , I am unable to modify this method. I want to change the DB creation logic so that DB gets created on Azure elastic pool

Can you please guide me how to extend existing template method to achieve this functionality ?

Thanks you

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This class is defined in the framework, see https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.ZeroCore.EntityFrameworkCore/Zero/EntityFrameworkCore/AbpZeroDbMigrator.cs. You can create your own implementation of IAbpZeroDbMigrator and replace it in your app using something like below in the PreInitialize method of your module class;

    Configuration.ReplaceService<IAbpZeroDbMigrator, MyAbpZeroDbMigrator>(DependencyLifeStyle.Transient);
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    rajalla created

    Hello Omkar,

    Were you able to successfully implement this? We are considering this for one of our future projects and wondering if you ran into issues using Elastic pools. Any insight is appreciated.

    Thanks, Raj.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)