title: Dynamic SQL Query Entity Framework
body: <p>I searched though many posts on stack overflow to get me an answer but I am not clear yet. I am just looking for some simple way to build dynamic queries. I was able to do simple queries involving single expression in where clause but I am not able to find any easy way to handle multiple expressions. I have experience of working with NHibernate criteria API which is very handy for rapid and compile time safe query constructions. I though something similar will be available on EntityFramework but so far no luck. Is there any easy way beside manually building string queries? Have a look at following code I thought it should work but it doesn't. Actually it doesn't builds query upon multiple lambda expressions. I was expecting that each where call will add one AND expression to where clause. Am I missing something ?</p>
  
  <pre><code>var query = Entities.Current.Jobs.AsQueryable&lt;Job&gt;();
  
              if (!string.IsNullOrEmpty(keywords))
              {
                  query.Where(j =&gt; j.Title.Contains(keywords) || j.Description.Contains(keywords));
              }
  
              if (industryId &gt; 0)
              {
                  query.Where(j =&gt; j.IndustryId == industryId);
              }
  
              if (countyId &gt; 0)
              {
                  query.Where(j =&gt; j.CountyId == countyId);
              }
  
              return query.ToList&lt;Job&gt;();
  </code></pre>