Base solution for your next web application
Open Closed

Set Default Tenant #11892


User avatar
0
alliance225 created

Hello, I am using asp.net core mvc. I have multitenancy enabled but for now I have only one tenant with many users. on login page I want to set by default tenant to the current tenant which is not default.

How do i achieve that?


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

    Hi,

    For a better design, you can create a custom TenantResolveContributor, see https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant

    • This custom TenantResolveContributor can set the tenant to existing one always.
    • You need to insert your custom class to first item into Configuration.MultiTenancy.Resolvers list.

    If you have more tenants in the future you can delete this class or it can automatically skip to set tenant if there are more than 1 tenant in the DB.