16

私は DDD を始めたばかりで、データのリレーショナルな性質に対応する方法を理解するのに苦労しています。集約ルートと見なされると思われるものがありますが、集約には独自の集約もあります。デメテルの法則に違反したくないので、私はこれについて間違った考えを持っているのではないかと考えており、DDD の専門家が何らかの洞察を提供してくれることを望んでいます。

私の集約ルートは、それ自体が個々のエンティティの論理グループであるAccount多数のエンティティの集約を持つオブジェクトです。AccountElementProductComponent

anAccountElementのコンテキストの外側には意味がないので、オブジェクトが集計ルートでAccountあるという結論に満足しており、そのエンティティが集計プロパティを持つことを期待しています。それは私を混乱させたコレクションです。この集合体は 以外では意味がなく、実際には 以外では意味がありません。AccountElementsProductComponentAccountElementAccount

ProductComponent次のように、点を打って個々のオブジェクトにアクセスする必要はないと思います。

var reference = account.Elements(0).ProductComponents(0).ReferenceCode;

But at the same time it doesn't make sense (from a domain perspective) to access a ProductComponent directly from an Account entity.

I'm sure that this is all a little difficult to comprehend without knowledge of my domain, but I'm hoping it's enough to get some good feedback.

4

1 に答える 1

2

ロバートがリンクしている記事は良い記事です。ProductComponent が AccountElement のコンテキストにのみ存在し、AccountElement が Account のコンテキストにのみ存在する場合、拡張により ProductComponent は Account のコンテキストにあることを付け加えておきます。

于 2010-02-05T22:56:49.850 に答える