Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The pros; composability:</p> <ul> <li>callers can add filters</li> <li>callers can add paging</li> <li>callers can add sorting</li> <li>etc</li> </ul> <p>The cons; non-testability:</p> <ul> <li>Your repository is no longer properly unit testable; you can't rely on a: it working, b: <strong>what</strong> it does; <ul> <li>the caller could add a non-translatable function (i.e. no TSQL mapping; breaks at runtime)</li> <li>the caller could add a filter/sort that makes it perform like a dog</li> </ul></li> <li>Since callers expect <code>IQueryable&lt;T&gt;</code> to be composable, it rules out non-composable implementations - or it forces you to write your own query provider for them</li> <li>it means you can't optimize / profile the DAL</li> </ul> <p>For stability, I've taken to <strong>not</strong> exposing <code>IQueryable&lt;T&gt;</code> or <code>Expression&lt;...&gt;</code> on my repositories. This means I know how the repository behaves, and my upper layers can use mocks without worrying "does the actual repository support this?" (forcing integration tests).</p> <p>I still use <code>IQueryable&lt;T&gt;</code> etc <em>inside</em> the repository - but not over the boundary. I posted some <a href="http://marcgravell.blogspot.com/2009/02/pragmatic-linq.html" rel="noreferrer">more thoughts on this theme here</a>. It is just as easy to put paging parameters on the repository interface. You can even use extension methods (on the interface) to add <em>optional</em> paging parameters, so that the concrete classes only have 1 method to implement, but there may be 2 or 3 overloads available to the caller.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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