打开 关闭

Make data seeding optional in method TenantAppService.CreateAsync #383


User avatar
0
rachanee-mwp 创建
  • ABP Framework version: v3.0.5

Just noticed that you added a step to seed data when creating a tenant. This is an unwanted behavior for us, so we would like to request you to make the data seeding in the TenantAppService.CreateAsync be optional. Note: Right now we overriden the method and remove the lines for data seeding, but It may not be good for the future update because we have to keep checking if you changed anything in the method and clone that to our overriden method.

You may do like this:

[Authorize(SaasHostPermissions.Tenants.Create)]
public virtual async Task<SaasTenantDto> CreateAsync(SaasTenantCreateDto input, bool seedData)
{
    ...

    if (seedData)
    {
        using (CurrentTenant.Change(tenant.Id, tenant.Name))
        {
            //TODO: Handle database creation?

            await DataSeeder.SeedAsync(
                new DataSeedContext(tenant.Id)
                    .WithProperty("AdminEmail", input.AdminEmailAddress)
                    .WithProperty("AdminPassword", input.AdminPassword)
            );
        }
    }

    ...
}

1 答案
  • User Avatar
    0
    alper 创建
    支持团队 Director

    why you don't want to seed the tenant database?

Made with ❤️ on ABP v8.2.0-preview Updated on 三月 25, 2024, 15:11