title: Best option for dynamic queries?
body: <p>I'm working on porting an old application to from WebForms to MVC, and part of that process is tearing out the existing data layer, moving the logic from stored procedures to code. As I have initially only worked with basic C# SQL functions (System.Data.SqlClient), I went with a lightweight pseudo-ORM (<a href="http://www.toptensoftware.com/petapoco/" rel="nofollow noreferrer">PetaPoco</a>), which just takes a SQL statement as a string and executes it. Building dynamic queries would work about the same in SQL - lots of conditionals that add and remove additional code (average query has ~30 filters). </p>
  
  <p>So after looking around a bit, I found some choices:</p>
  
  <ul>
  <li>A bunch of strings and conditionals that add bits of the query as they are needed. Really nasty, especially when queries get complex, and not something I want to pursue if a better solution exists.</li>
  <li><a href="https://stackoverflow.com/questions/5541234/creating-dynamic-queries-with-entity-framework">A bunch of conditionals using L2E</a>. Looks more elegant, but I tested L2E is too bloated in general was an awful experience. Could I do the same thing in L2S? If so, is L2S going to stick around for the next 5-10 years?</li>
  <li>Use a <a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="nofollow noreferrer">PredicateBuilder</a>. Still looking into this, same questions regarding L2S.</li>
  <li>EDIT: I can also just stick to the existing stored procedure model, but I have to rewrite them anyway, so it can't hurt to look at other options as I'm still going to have to do the leg work.</li>
  </ul>
  
  <p>Are there any other options out there? Can anyone weigh in with some experience on any of the mentioned methods - mainly, did the method you choose make you want to build a time machine and kill past you for implementing it?</p>