title: Creating a Dynamic Where Clause as a Linq Expression
body: <p>I am trying to dynamically append where conditions into a single expression-object, then pass that expression-object into a method that will use it.  However, I keep getting "class name is not available at this point".</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>UPDATE:</strong><br/>
  I finally was able to create a <a href="https://stackoverflow.com/questions/8153260/are-linq-to-sql-dynamic-where-clauses-even-possible-in-framework-3-5"><strong>working example here</strong></a>.</p>
  
  <p><strong>The Code Look Like:</strong><br/></p>
  
  <pre><code>    var view = new vw_QuickFindResult();
  
     // This wont compile
      Expression&lt;Func&lt;vw_QuickFindResult, bool&gt;&gt; where = Expression&lt;Func&lt;vw_QuickFindResult, bool&gt;&gt;(view, true);
  
      // Build LIKE Statement
      var searches = new List&lt;String&gt;(searchText.Split(' '));
      searches.ForEach(productName =&gt;
      {
          productName.Replace('"', '%');
          productName.Replace('*', '%');
          where = x =&gt; SqlMethods.Like(view.DocumentName, productName);
      });
  
      return DocumentCollectionService.ListQuickFind(where);
  </code></pre>