Domain Driven Design Unit Of Work
Method because the domain objects are being tracked by the object context and we would just need to add a save method on the unit of work to have the object context.
Domain driven design unit of work. Search everywhere only in this topic. Consider the infrastructure external and don t make any of the other layers depend on it. Initially this wasnt a problem because our design was setup where we had a unit of work that looked like this.
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. Moreover this transaction based mechanism rests on the academic formalities of a design pattern commonly known as unit of work. When you re pulling data in and out of a database it s important to keep track of what you ve changed.
Apart from domain driven design considerations the simple benefits is performance. Derive from a base unit of work interface if you want to represent a specific group of. 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.
Otherwise that data won t be. Use a dependency resolution project for the di wiring. So for an iorderrepository this would become something like.
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. 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. Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.