title: search query in entity framework 3.5
body: <p>I need to build a search query on Customers table join with orders table</p>
  
  <pre><code>string firstname  = "Joe";
   string emailFilter = "joe@email.com";
   string city=null;
  </code></pre>
  
  <p>In SQL we can make like this</p>
  
  <pre><code>SELECT @sql =                                                       
      'SELECT  * from  
       FROM   dbo.Orders o                                     
       inner join
       JOIN   dbo.Customers c ON o.CustomerID = c.CustomerID      
          WHERE  1 = 1'       
  
  IF @firstname IS NOT NULL                                             
     SELECT @sql = @sql + ' AND c.firstname= @firstname'          
  
  
  IF @city IS NOT NULL                                         
     SELECT @sql = @sql + ' AND c.city &gt;= @city'
  </code></pre>
  
  <p>I need to build a entity framework 3.5 linq query joined with orders and customers table
  with dynamic search condition.</p>
  
  <p>if the values are not null, i need to use in where clause in linq</p>
  
  <p>I am new to Linq.
  shall we need to use Iqueryable.
  Any help appreciated.</p>
  
  <p>Thanks</p>