Starts in:
2 DAYS
7 HRS
32 MIN
5 SEC
Starts in:
2 D
7 H
32 M
5 S
Open Closed

Module Object Extensions & Navigation Property for Another Entity #1099


User avatar
0
viswajwalith created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Microservice Template
  • Exception message and stack trace:
  • Steps to reproduce the issue:

We Would like to Extend the Organization Structure object with additional fileds, I know we have follow https://docs.abp.io/en/abp/latest/Module-Entity-Extensions , but I dont find a way for MicroService tempalte. Also we would like to use the updated object as Navigation Property for Another Entity (Similar to https://community.abp.io/articles/abp-suite-how-to-add-the-user-entity-as-a-navigation-property-of-another-entity-furp75ex).

You you please help us in doing the above things as part of MicroService template with AngularUI


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

    do you want to use an entity from another microservice as a navigation property?

  • User Avatar
    0
    viswajwalith created

    do you want to use an entity from another microservice as a navigation property?

    Yes, We would like to have the enity from another microservice/Standard modules like Locations as a navigation property. We are not not able to find a way to use that.

    Also we would like to extend the User Module with additional/extra properties. This is working fine with Monolethic but not able to find a way to do this with MicroService template.

  • User Avatar
    0
    alper created
    Support Team Director

    you cannot make a navigation property to a remote service entity. it violates the module's best practises. each module has its own entities which should not be independant to another module entity. if you need such requirement, you should duplicate the entity in your module. eg: I have abp.io websites and I have support.abp.io website and imagine these are 2 different modules. each are hosted on different servers with different databases. I have users in abp.io website's database and I want that users in support.abp.io. The solution is; creating a new entity SupportUser in support.abp.io and sync it with distributed events. whenever a new user is created on abp.io then an event should be published to support.abp.io to create the same user there.

    this is not a framework limitation but it's an architecure issue.

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    do you want to use an entity from another microservice as a navigation property?

    Yes, We would like to have the enity from another microservice/Standard modules like Locations as a navigation property. We are not not able to find a way to use that.

    This is against the very nature of microservice architecture. Each microservice has its own data store (database). You can not expect efcore magically map a related entity to an other entity hosted in a different microservice using MongoDB. And you shouldn't. Even if you use the same db, you need to reference to Id only and map it yourself in repository layer. I would suggest reconsidering adding navigation property in your aggragate roots.

    Sample:

    If you have 1-1 relations between Order and OrderInfo, you need to create a repository method with implementation something like: <br>

    var query = from orderInfo in await GetDbSetAsync()
        join order in (await GetDbContextAsync()).Set<Order>() on orderInfo.Id equals order.orderInfoId into
            orderWithInfo    from order in orderWithInfo.DefaultIfEmpty()
        select new
        {
            OrderInfo = orderInfo,
            Order = order
        };
    

    Also, please refer to Domain Driven Implementation Guide for more information. It is a greate guide to learn and improve knowledge about DDD.

    Also we would like to extend the User Module with additional/extra properties. This is working fine with Monolethic but not able to find a way to do this with MicroService template.

    You need to update Identity.Service. Configure it at ModuleExtensionConfigurator under IdentityService.Domain.Shared project.

  • User Avatar
    0
    viswajwalith created

    You need to update Identity.Service. Configure it at ModuleExtensionConfigurator under IdentityService.Domain.Shared project.

    I will try the ModuleExtensionConfigurator and update you

  • User Avatar
    0
    alper created
    Support Team Director

    thanks

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06