title: DDD specification pattern with stored procedure
body: <p>I am going to write a stored procedure which will pull back X number of records based on a query. This SP may need to lock the records while it does the search. I am also using EF which I know can't use pessimistic locking.</p>
  
  <p>Instead of having the filtering logic in the query itself I was thinking of using the specification pattern so the business logic will dictate the query. If I use this pattern and pass through the specification into my repository which in turn calls the SP how will the SP know what to do with the specification?</p>
  
  <p>The specification can consist of criteria spanning multiple tables and sorting on different columns.</p>
  
  <p>Would it make sense to use the specification pattern in this scenario or should I just create the SP with the query and filtering defined in there?</p>