Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think <em>willbt</em> has given you a really good <a href="https://stackoverflow.com/questions/1517033/how-to-implement-the-query-side-of-cqs-in-ddd/1549669#1549669">starting point</a>.</p> <p>I would add that if you do opt to continue to use the ORM as the data-access strategy for queries you would be well-advised to consider defining a fetching strategy tailored to the data you expect you'll need to access (I'm thinking specifically about NHibernate here, by the way). What this means is you can decide whether to lazy-load or to eager-load the objects and collections associated with a particular <a href="http://dddstepbystep.com/wikis/ddd/aggregate-root.aspx" rel="nofollow noreferrer">Aggregate Root</a> object.</p> <p>The <a href="http://github.com/riteshrao/ncommon" rel="nofollow noreferrer">NCommon project</a> by Ritesh Rao offers an excellent (work in progress) demonstration of how to define a different fetching strategy for different purposes.</p> <p>Ritesh <a href="http://www.codeinsanity.com/2009/02/fetching-strategy-and-adaptive-domain.html" rel="nofollow noreferrer">explains it really</a> well in his blog.</p> <p>Go ahead and have a look at the source:</p> <ul> <li>here's <a href="http://github.com/riteshrao/ncommon/blob/master/NCommon/src/Data/IFetchingStrategy.cs" rel="nofollow noreferrer">the IFetchingStrategy interface</a></li> <li>and this shows <a href="http://github.com/riteshrao/ncommon/blob/master/NCommon.NHibernate/tests/NHRepositoryTests.cs" rel="nofollow noreferrer">the use of fetching strategies in a unit test</a></li> </ul> <p>In the test 'Repository_For_Uses_Registered_Fetching_Strategies' the call to </p> <pre><code>NHRepository&lt;Order&gt;().For&lt;NHRepositoryTests&gt;() </code></pre> <p>...causes the fetching strategies registered against the NHRepositoryTests class to be used, and therefore the OrderItems and Products will be eager loaded without messing about with NHibernate mapping configurations.</p>
    singulars
    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. VO
      singulars
      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