Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the general concept would be to have "Commands" and "Queries", and within those you can take dependencies on Repositories.</p> <p>I have actually refactored an ASP.NET MVC project where each Controller depended on one or more repositories to get it's work done. When I refactored it, I created "Command" and "Query" objects for each specific action that needed to happen which greatly simplified each controller. Then in those commands and queries I used the existing repositories to perform the logic.</p> <p>It may seem like extra effort, but the reason I did it was because the solution also had caching. The caching code was a mess, there were cache keys being added to and removed from all over the place. By separating all data access into commands and queries, then raising domain events when data was accessed or updated the cache management code could be simplified and separated out.</p> <p>For an overview of how I implement a simple command/query separation please see my recent blog post on the topic which also has sample code and NuGet packages to help you get setup quicker: <a href="http://www.nootn.com.au/2013/03/command-query-separation-to-better.html" rel="nofollow">http://www.nootn.com.au/2013/03/command-query-separation-to-better.html</a></p> <p>In particular to answer your question "What happens when there is some common Read requirement across all business objects": just imagine that the Query and Command classes I have there take some common "IRepository" dependency instead of a "DBContext" as my example does and that is how you can "share" that common read requirement across business objects.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload