Domain Driven Design Unit Of Work
The unit of work and transactions in domain driven design published on 02 september 2015 in domain driven design as a principle the unit of work uow pattern is about ensuring consistency by persisting a group of changes as a unit all at once.
Domain driven design unit of work. Taken that your repository interfaces are on the edge of your domain these should as you say only include methods that are relevant for retrieving and or adding aggregates. Moreover this transaction based mechanism rests on the academic formalities of a design pattern commonly known as unit of work. Use a dependency resolution project for the di wiring. Cautions applying repository and unit of work patterns with dependency injection in domain driven design.
Initially this wasnt a problem because our design was setup where we had a unit of work that looked like this. Otherwise that data won t be. For a full description see p of eaa page 184. Search everywhere only in this topic.
Derive from a base unit of work interface if you want to represent a specific group of. Consider the infrastructure external and don t make any of the other layers depend on it. So for an iorderrepository this would become something like. Domain driven design ddd is the concept that the structure and language of software code class names class methods class variables should match the business domain for example if a software processes loan applications it might have classes such as loanapplication and customer and methods such as acceptoffer and withdraw.
For starters the unit of work in it s technical sense is indeed in an infrastructural concern and no code related to it should be put into your domain. Registering domain objects with a unit of work. Apart from domain driven design considerations the simple benefits is performance.