Skip to content

Passing services into Domain layer. #136

Answered by AndreiGanichev
ichensky asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!
You should keep your domain model as isolated as possible. This means it must operate only primitive types(or domain primitives) and domain objects and have no dependecies to any external logic(call database or 3rd party services). This constraint helps to express properly ubiquotous language, makes domain model easier to understand(not to add accidential complexity to essential one) and test.
Repository and Domain service are part of domain model but it's also recommended not to pass them to aggregates[1]:

Use a repository or domain service to look up dependent objects ahead of invoking the aggregate behavior. A client application service may control this, then dispatch to the aggre…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kgrzybek
Comment options

@AndreiGanichev
Comment options

Answer selected by kgrzybek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants