Base solution for your next web application
Open Closed

Change Default Tenancy Name #2767


User avatar
0
velu created

How to Change Default Tenancy Name while migration?

Please help me on that.


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

    Hi,

    You can change it in CreateDefaultTenant method of DefaultTenantBuilder class. But this only changes it for migration and probably, you will have some other problems.

    Instead of that, please add below constant to Tenant class.

    public new const string DefaultTenantName = "NewDefaultTenantName";
    
  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    You can change it in CreateDefaultTenant method of DefaultTenantBuilder class. But this only changes it for migration and probably, you will have some other problems.

    Instead of that, please add below constant to Tenant class.

    public new const string DefaultTenantName = "NewDefaultTenantName";
    

    Please confirm the file Name.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is Tenant.cs file in MultiTenancy folder of your *.Core project.

  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    It is Tenant.cs file in MultiTenancy folder of your *.Core project.

    This is Tenant file. Where to add in this?

    public class Tenant : AbpTenant<User> { //Can add application specific tenant properties here

        protected Tenant()
        {
    
        }
    
        public Tenant(string tenancyName, string name)
            : base(tenancyName, name)
        {
    
        }
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Below this line,

    //Can add application specific tenant properties here
    
  • User Avatar
    0
    velu created

    Is it Correct? I can't understand. How it assign as default tanant? Please explain...

    public class Tenant : AbpTenant<User> { //Can add application specific tenant properties here

    public new const string DefaultTenantName = "NewDefaultTenantName";

    protected Tenant() {

    }

    public Tenant(string tenancyName, string name) : base(tenancyName, name) {

    } }

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is used in DefaultTenantBuilder when seeding database here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.EntityFramework/Migrations/Seed/Tenants/DefaultTenantBuilder.cs#L25">https://github.com/aspnetzero/aspnet-ze ... der.cs#L25</a>.