Like lulian, I think there are no rules that say what your AR should look like. If your AR with ObjectA, B, and C is in the same business context, that's fine. But I think you should also think about how your clients / use cases using your model. If you always want ObjectC and crawling an object from ObjectA and B to C to be perceived as an unnecessary crawl, then your model might be wrong.
If your root object is ObjectA, and you have an ObjectARepository, you can always add repository methods, such as GetObjectCsByObjectA (ObjectA objectA), which will display all C for A. If the ObjectC object can be a child of several ObjectB objects, which is the solution above, maybe is not the best since you get all C for one A.
Most importantly, how your GUI / clients will use this AR (repeat it yourself ...) You can add extension methods to add Linq filters or searches to make it easier to go from A to C. Not my favorite, but it works. Itβs best to try to wrap the ObjectB collection in ObjectA with either a Value object or just a listwrapper class that is not saved and is created only when accessing this collection. This shell can provide the necessary access methods appropriate to your GUI, as well as checks when adding, replacing, and deleting list items. The wrapper will be a shortcut for your customers, so they donβt have to worry about how AR is created inside AR.
Does ObjectB and ObjectC have any associations with other objects outside this AR?
source share