Open Closed

Best way to utilize other microservice entities #7236


User avatar
0
WaelRazouk created
  • ABP Framework version: v8.1.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I'm building an app using the micro-service template. I have an entity called Service in my microservice project, this entity has some navigation properties related to Identity entities (Owner which should relate to IdentityUser entity, and Department which should relate to OrganizationUnit entity).

What is the best way to define this relation?

I searched some topics and read the docs:

  • one way is to define an entity in my project which reflects the desired entity (just like CMS kit defines CMSUser which synchronizes with IdentityUser). but IdentityUser has some useful code to do this like UserLookupService (defined in Volo.Abp.Users). OrganizationUnit doesn't.
  • Another way is to include the desired module (i.e: Identity module) and in ABP suite define the navigation using pre-built modules from ABP (but this way increases the coupling between the services I think)

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    One way is a good approach. You can use GUID? UserId in your module.

  • User Avatar
    0
    WaelRazouk created

    hi

    One way is a good approach. You can use GUID? UserId in your module.

    You mean just define a property UserId in my module without any relation? or define an entity replica to IdentityUser entity and connect my Service entity to it?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You mean just define a property UserId in my module without any relation?

    Yes, Different modules/micro-services may use different databases. So, use UserId in a good way.

    If you want to get the user info, you can communication between micro-services.

    https://docs.abp.io/en/commercial/latest/startup-templates/microservice/interservice-communication

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