DDD - How to design associations between different bounded contexts

前端 未结 3 1316
名媛妹妹
名媛妹妹 2021-02-03 12:33

I have setup a domain project which is being populated with an ORM. The domain contains of different aggregates each with its own root object. My question is how properties that

3条回答
  •  一整个雨季
    2021-02-03 12:55

    You should avoid DB references across BCs - you shouldn't try to ensure referential integrity between aggregates from different BCs (transactions). Ideally, transaction should live only inside single aggregate, not even BC.

    Better use simple value objects for IDs - UserId and GameId - and assign them to entity if needed. This way those "remote" entities are completely detached so you don't have to worry about their connection. Sync could be implemented using messaging platform.

    If you have spare time read these valuable articles (by Vaughn Vernon):

    • http://ffffdcommunity.org/wp-content/uploads/files/pdf_articles/Vernon_2011_1.pdf
    • http://ffffdcommunity.org/wp-content/uploads/files/pdf_articles/Vernon_2011_2.pdf
    • http://ffffdcommunity.org/wp-content/uploads/files/pdf_articles/Vernon_2011_3.pdf

提交回复
热议问题