Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Just wondering, but where did the Line object in public void HideLine(Line line) come from? I mean surely it didn't come from the database because only aggregates have repositories. Commented Nov 12, 2014 at 1:05
  • I answered. Check the updated question and let me know what do you think about it. Commented Nov 12, 2014 at 9:27
  • hmmmm why don't you make a function order.validateLines(validator) to encapsulate the validation logic? Commented Nov 12, 2014 at 9:47
  • And what about to call the validator directly inside the aggregate? Doing order.validateLines() without parameter? Does this create a problem of high coupling avoidable in aggregate? Commented Nov 12, 2014 at 10:10
  • well it depends :) Validation is a nasty topic which depends on the context. Why are you validating the order? Normally I would validate the aggregate in the constructor or in a dedicated factory class if the validation logic is complex enough. A validator is a service which may change implementation at some time and I hate injecting service s inside entities. It all depends on the complexity of the validation. Commented Nov 12, 2014 at 11:42