How to Reference a User Entity from Another Microservice in ASP.NET Core?
In my microservices architecture using ASP.NET Core, I have two distinct microservices: Identity.API
for user management and PersonalAccount.API
for handling personal account-related functionalities. Each microservice operates with its own separate database. In PersonalAccount.API
, I have a Project
entity with a ManagerID
field intended to reference a User
entity from the Identity.API
microservice.
Since Identity.API
and PersonalAccount.API
are separate projects and databases, there is no direct database-level foreign key constraint possible between them. This situation creates challenges in managing and validating the reference to a user across microservices. I’m seeking guidance on the best approach to handle such cross-service references, ensure data consistency, and maintain integrity between these microservices.