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

CreateTenant error: entity not found #2263


User avatar
0
bobiasg created

I use module zero template, version 1.2. In create tenant from TenantAppService, with admin username different than "admin", it throw error: "There is no entity User with id = xx".

View in source code, I found error cause by: CheckErrors(await UserManager.AddToRoleAsync(adminUser.Id, adminRole.Name)); (TenantAppService)

In UserManager.AddToRoleAsync, it call UpdateAsync --> GetOldUserNameAsync because username is not equal "admin" --> AbpStore.GetUserNameFromDatabaseAsync.

In AbpStore.GetUserNameFromDatabaseAsync, it begin new UnitOfWork with tenantId from AbpSession. And _userRepository.GetAsync(userId) throw error.

It is new code is updated in v 1.2.


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

    Hi @Bobiasg,

    Did you add a username field to tenant registration form ? As far as I remember, current version does not have username field.

  • User Avatar
    0
    bobiasg created

    Hi @ismcagdas,

    I added a username field to tenant registration form. And with username is not equal 'admin', I throw error: 'entity not found'.

    Do Abp Module Zero require admin username must be 'admin' ? How should i do if i want custom admin username in tenant registration ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is clear now. Currently, template only allows admin username. You can create an issue on github here <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-template/issues">https://github.com/aspnetboilerplate/mo ... ate/issues</a> and we will consider this.

    Thank you for the information.