Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:21:48+00:00 2026-06-18T12:21:48+00:00

• We can express an association between two entities via object reference ( though

  • 0

• We can express an association between two entities via object reference ( though a relationship between Aggregate root and its internal entity could also be expressed via a method defined on a root –> SomeRootEnt.BorrowMeIntEnt(...) ) or via Repository, which would retrieve related entities from a database.
• When relationship is expressed via Repository, client would directly call a Repository to obtain related entity(ies)
• The decision on how to express a relationship is based on whether this relationship is required for maintaining an integrity ( and perhaps on whether behavior requires association to be able to express itself )

1) If relationship ( say 1:* ) is expressed via Repository, are child entities required to contain an ID of a parent entity ( Note: this question is assuming that either at least a parent is a root or that they all reside within same aggregate )?

2) The relationship between entities in different aggregates should only be expressed by IDs

a) Why?

b) Wouldn’t such a relationship essentially be expressed via Repository?

c) If yes to b), this would also suggest that associations between entities in different aggregates in most cases aren’t required for the purpose of supporting a particular behavior? If yes, why?

UPDATE:

2a)

Expressing relationship with an identity reference is different from
expressing the relationship with an object reference. The reason that
the relationship should be expressed with an identity is to maintain
transactional integrity – ie only a single aggregate will be modified
in any given transaction. If an object reference was used, two
aggregates could be affected by a transaction.

I – I understand the point you’re trying to make, since if relationship would be expressed with an object reference, then simply for the fact that aggregate A1 ( which is being modified ) is “physically” connected to another aggregate A2, it means one of A1’s parts ( ie A2 <– in reality A2 is not really a part of A1, but hopefully you understand the point ) is not in sync with other parts?!

II – But conceptually speaking, if we modify A1, then even if the relationship between the two is not expressed using object reference, the two aggregates are still out of sync, so in practical terms, what difference does it make whether A1 and A2 are physically connected?

III – Anyways, why couldn’t we in BOTH cases simply use eventual consistency?

SECOND UPDATE:

original_2)

To be clear, relationships between root entities (ARs) should be
expressed with identities. References between non-root entities in
distinct aggregates should be forbidden.

Can we have unidirectional associations traversable only from A1 non-root entity(ies) to A2 root entity ( ie non-root entity in A1 would contain ID of A2 root )?

2)
a)

I.

If an object reference was used, two aggregates could be affected by a
transaction.

It creates a possibility of A2 being modified in the transaction which
is modifying A1. Referencing A2 by identity eliminates this
possibility. Also, things such as database locking won’t apply to A2
when loading A1.

Ignoring for a moment the fact that DB locking won’t apply to A2 when updating A1 – why shouldn’t we in certain situations allow both A1 and A2 to be modified within a single transaction?

I know aggregates define consistency boundary, but if in rare cases we need both A1 and A2 to be synchronized within same transaction, then only other alternative may be to convert both A1 and A2 into a single aggregate, which in that particular model may not be appropriate?!

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:21:49+00:00Added an answer on June 18, 2026 at 12:21 pm

    1) Yes. For example, suppose you have a customer with orders. To get all the orders for a customer, you can select all orders with a corresponding CustomerId via orders repository.

    2) To be clear, relationships between root entities (ARs) should be expressed with identities. References between non-root entities in distinct aggregates should be forbidden.

    2a) Expressing relationship with an identity reference is different from expressing the relationship with an object reference. The reason that the relationship should be expressed with an identity is to maintain transactional integrity – ie only a single aggregate will be modified in any given transaction. If an object reference was used, two aggregates could be affected by a transaction.

    2b) Yes. A repository allows the traversal and the identity expresses the relationship.

    2c) This is the whole point of an aggregate – it should define a consistency boundary. If changes to an aggregate should affect aggregates, those changes should be capable of being applied in an eventually consistent manner.

    UPDATE

    2a1) It creates a possibility of A2 being modified in the transaction which is modifying A1. Referencing A2 by identity eliminates this possibility. Also, things such as database locking won’t apply to A2 when loading A1.

    2a2) If the transaction which modifies A1 results in changes that need to be applied to A2, those changes will be synchronized eventually. The reason for keeping them physically separate are stated in 2a1.

    2a3) You could, but again, reasons specified in 2a1 explain why it is better to use identity references.

    UPDATE 2

    2) I suppose if the integrity of the two ARs is maintained and the reference makes life a lot easier it can be acceptable. The reference is not itself a problem, it can lead to problems.

    2a1) One reason for this is rooted in more modern document database architectures. Document databases usually only support atomic transactions on a single document. Another reason is that two ARs may be stored in different databases, in which case a distributed transaction would be required to maintain consistency. However, a relational database can certainly lock multiple tables and so a scenario where two ARs are modified in a transaction are possible. As a result, these constraints should be understood as guidelines. If all ramifications are understood and caution is used, then it can be acceptable to update two ARs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TFS Express 11 beta installation also includes SQL Express installation for its database. Can
Hopefully I can express this in a coherent and meaningful way: Two of our
How can express this javascript object defintion in a way that value of first
how can i express in xpath a) need select elements which contains specified keyword.
Can I deploy SQL Server Express with my desktop application just like builtin database?
Can I develop Silverlight applications in Visual Studio express? When I start up Visual
Can AnkhSVN be installed on an Express edition of Visual Studio?
I can't create New Project on my Visual Web Developer 2008 Express with SP1.
UPDATE: After updating to stylus 0.7.4 and express 2.3.12 I can no longer reproduce
I'm having trouble accessing my IIS 7.5 express site in FireFox but i can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.