Base solution for your next web application
Open Closed

How difficult is it to extend tenant to multiple Editions? #3104


User avatar
0
yais1021 created

We are starting a project with ASP.NET MVC 5.x, Web API and AngularJs 1.x. We are looking to extend the code to assign multiple editions to a tenant. The current setup is one edition per one tenant. How difficult would it be to make this change?


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

    It requires changes in the framework level and not easy for you. But we believe that it's no proper to assign multiple edition to a single tenant. Can you write your use cases, so we can understand if it's a common requirement.

  • User Avatar
    0
    yais1021 created

    Thank you for your response.

    We have a scenario that is essential for our application to ensure SOLID architecture in our project. Our application will include the following:

    1- multiple tenants 2- Multiple set of features and sub-features

    We need to create plans/editions, based on each edition, a set of features will be assigned.

    Business rules:

    • Tenant can subscribe to multiple plans
    • The application provides 3 Services, each service will have 2 or more plan.

    Example: an Application will provide three services, Sell Computers, Sell Tablets, Sell Phones for sale

    Sell Computers 1- Silver Plan (feature: Sell maximum of 5 computers at a time) 2- Gold Plan (feature: Sell maximum of 10 computers at a time)

    Sell Tablets

    1. Bronze Plan (Feature: Sell Maximum of 5 Tablets at a time)
    2. Silver Plan (Features: Sell Maximum of 10 Tablets at a time)
    3. Gold Plan ( Sell Maximum of 15 Tablets at a time)

    Sell Phones 1.Free Plan (Feature: Sell Maximum of 1 phone at a time) 2. Bronze Plan (Feature: Sell Maximum of 5 phones at a time) 3. Silver Plan (Features: Sell Maximum of 10 phones at a time) 4. Gold Plan ( Sell Maximum of 15 phones at a time)

    We need to be able to create all these plans through editions and set the features to each edition. A tenant can subscribe to zero or one plan in each service.

    With the current setup, I would have to create 24 editions.

    1. Sell Computers Silver Plan features + Sell Tablets Bronze Plan Features + Sell Phones Free Plan Features

    2. Sell Computers Silver Plan features + Sell Tablets Bronze Plan Features + Sell Phones Bronze Plan Features

    3. Sell Computers Silver Plan features + Sell Tablets Bronze Plan Features + Sell Phones Silver Plan Features

    4. Sell Computers Silver Plan features + Sell Tablets Bronze Plan Features + Sell Phones Gold Plan Features

    5. Sell Computers Silver Plan features + Sell Tablets Silver Plan Features + Sell Phones Free Plan Features

    6. Sell Computers Silver Plan features + Sell Tablets Silver Plan Features + Sell Phones Bronze Plan Features

    7. Sell Computers Silver Plan features + Sell Tablets Silver Plan Features + Sell Phones Silver Plan Features

    8. Sell Computers Silver Plan features + Sell Tablets Silver Plan Features + Sell Phones Gold Plan Features

    9. Sell Computers Silver Plan features + Sell Tablets Gold Plan Features + Sell Phones Free Plan Features

    10. Sell Computers Silver Plan features + Sell Tablets Gold Plan Features + Sell Phones Bronze Plan Features

    11. Sell Computers Silver Plan features + Sell Tablets Gold Plan Features + Sell Phones Silver Plan Features

    12. Sell Computers Silver Plan features + Sell Tablets Gold Plan Features + Sell Phones Gold Plan Features . . . . . 24 - Sell Computers Gold Plan features + Sell Tablets Gold Plan Features + Sell Phones Bronze Plan Features

    to cover this scenario with the current setup, you can imagine the maintenance it would take if we add a new features to one plan, we would have to go manually through all plans that should include that new feature or perhaps remove a feature from a plan.

    The way that I thought to implement this is to assign multiple editions to a tenant and have another table which would include the Tenant/Edition relationship where the tenant retrieves an ICollection<TenantEdition> Editions

    Thanks

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    I understand your situation and it seems reasonable for your scenario, while it's not proper for common SaaS subscription scenarios. I would suggest you to change your business model :)

    Anyway, you have 2 choice:

    1. Download source code of Abp.Zero packages (from <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero">https://github.com/aspnetboilerplate/module-zero</a>), include them into your solution and manipulate it freely. This provides you maximum flexibility, but surely then you can not upgrade these packages. If you do that;

    a) Change EditionId property to a collection of Editions as you suggested. b) Change AbpFeatureValueStore to check feature's value from all editions (<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/dev/src/Abp.Zero.Common/Application/Features/AbpFeatureValueStore.cs#L74">https://github.com/aspnetboilerplate/mo ... ore.cs#L74</a>). c) Change UI to reflect changes.

    1. You can instead try to extend Edition entity (like <a class="postlink" href="https://www.aspnetzero.com/Documents/Extending-Existing-Entities#extending-non-abstract-entities">https://www.aspnetzero.com/Documents/Ex ... t-entities</a>) and override FeatureValueStore methods or completely replace FeatureValueStore by your own implementation.

    Have a nice day.

  • User Avatar
    0
    yais1021 created

    I attempted to download the source for the Zero Moudle but VS is failing to load the projects. Are there changes that I need to make to the .csproj files?

    Thanks

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Which version of Visual Studio are you using?

  • User Avatar
    0
    yais1021 created

    <cite>alirizaadiyahsi: </cite> Hi,

    Which version of Visual Studio are you using?

    visual studio 2015 community edition.

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Could you please check this conversation? #3055@5b3f6128-2413-451b-b76e-8215a097684b