Search code examples
aspnetboilerplateasp.net-boilerplate

Invalid Tenancy Name


I am working on an ASP.NET Boilerplate service project.

When I am saving a client, it returns an error:

Tenancy Name is not valid

The tenancy name contains spaces. TenantDto maps to Tenant object without any error. Database table TenancyName column is nvarchar(64). Error occurs when it is saving.


Solution

  • From the documentation on Tenant Management:

    AbpTenant class defines some base properties, most important ones are:

    • TenancyName: This is unique name of a tenant in the application. It should not be changed normally. It can be used to allocate subdomains to tenants like 'mytenant.mydomain.com'. Tenant.TenancyNameRegex constant defines the naming rule.
    • Name: An arbitrary, human-readable, long name of the tenant.

    TenancyNameRegex is "^[a-zA-Z][a-zA-Z0-9_-]{1,}$" as spaces are not allowed in subdomains.

    As quoted above, use Name for the human-readable name (with spaces) of the tenant.