Globals.Tenant is not populated

Hi, I trying multitenancy in Blazor server app and I want show Tenant Name in Main layout. Trying to use Globals.Tenant.Name produce error because Globals.Tenant is null using a tenant user.

Can you give directions to solve this problem?

Thanks in advance.

This is something used in development only. In production when a user is logged you can get the tenant from the user.


It's working with ${Security.User.ApplicationTenant?.Name}


In development await Security.GetUsers() return null because globals.Tenant is null.

Any workaround? I need to populate a dropdown with list of username of current tenant.


Solved extending SecurityService class with:

public async Task<IEnumerable<ApplicationUser>> GetUsersByTenantId(int tenantId)
                return await Task.FromResult(context.Users.AsNoTracking().AsQueryable().Where(i => i.TenantId == tenantId).Include(i => i.ApplicationTenant));