Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Create new tenant in Azure #9619


User avatar
0
pablotola created

Trying to create a new tenant in azure fails, it just times out, sometimes it creates the database but does not seed the data, also the new tenant record is not created in the tenants table.


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

    hi pablotola

    Are there any error logs of the application?

  • User Avatar
    0
    pablotola created

    Thanks for the reply, I found what the error was and it's fixed, had to increase the CommandTimeout and that solved the problem.

    On another note I would like to override or replace the function that creates the tenant database and need some guidance. I need to create thne tenant databases in an Azure elastic pool.

    I think this is the function that creates and seeds the data:

    //Create tenant database _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);

    I was thinking about two options:

    1. Create the database before this method and keep the method to take care of the seeding.
    2. Override / Replace the method and code my own.

    What would you recommend? How will I be able to run the following command at this point:

    CREATE DATABASE DemoDB ( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = DemoPool ) ) ;

    Thanks for your help.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can inject IDbContextProvider, get a DbContext and execute SQL commands like below;

    context.Database.ExecuteSqlRawAsync or Database.ExecuteSqlRaw