Base solution for your next web application
Open Closed

How can I create new tenant instead of Default tenant? #5019


User avatar
0
bolenton created

Hi, I am trying to delete an existing Default Tenant and recreate databases with another tenant name which will have dedicated database for it. That works fine,but my unit test cases are always pointing to Default tenant and now they are failing. What is the right way to create a new Tenant instead of Default one after Host creation.Also unit test cases should be pointing to that tenant. Any help will be appreciated.


8 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    hi,

    If you want to change the name "Default" for the default tenancy name.

    • TenantConsts > DefaultTenantName = "MyDefault"
    • AbpTenantBase > DefaultTenantName = "MyDefault"
    • UserLinkAppService_Tests > LinkToUser() > TenancyName = "MyDefault"
  • User Avatar
    0
    bolenton created

    <cite>alper: </cite> hi,

    If you want to change the name "Default" for the default tenancy name.

    • TenantConsts > DefaultTenantName = "MyDefault"
    • AbpTenantBase > DefaultTenantName = "MyDefault"
    • UserLinkAppService_Tests > LinkToUser() > TenancyName = "MyDefault"

    we can't change the DefaultTenantName in AbpTenantBase as it is metadata file.How to do that?

  • User Avatar
    0
    alper created
    Support Team

    yes, you're right. it's a const. did you try to run the tests without that change?

  • User Avatar
    0
    bolenton created

    <cite>alper: </cite> yes, you're right. it's a const. did you try to run the tests without that change?

    Not yet.Because of that AbpTenantBase.DefaultTenantName can't be changed from metadata,when I try to use seed method the default tenant gets created which I don't want to.I want to create a tenant with another name.Is it possible to do that?

  • User Avatar
    0
    alper created
    Support Team

    Can you open an issue on GitHub to make it changeable? <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/new">https://github.com/aspnetboilerplate/as ... issues/new</a>

  • User Avatar
    0
    bolenton created

    <cite>alper: </cite> Can you open an issue on GitHub to make it changeable? <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/new">https://github.com/aspnetboilerplate/as ... issues/new</a>

    Ok,I will create an issue for it. Thanks

  • User Avatar
    0
    registosglintt created

    Hi,

    Did you create a issue? I didn't find it :(

    How did you solve this problem?

    Thanks in advice,

  • User Avatar
    0
    ismcagdas created
    Support Team

    @registosglintt since it is a const in ABP Framework, you can't change it. But you can create different tenant of course.