title: String.IsNullOrWhiteSpace in LINQ Expression
body: <p>I have the following code:</p>
  
  <pre><code>return this.ObjectContext.BranchCostDetails.Where(
      b =&gt; b.TarrifId == tariffId &amp;&amp; b.Diameter == diameter
          || (b.TarrifId==tariffId &amp;&amp; !string.IsNullOrWhiteSpace(b.Diameter))
          || (!b.TarrifId.HasValue) &amp;&amp; b.Diameter==diameter);
  </code></pre>
  
  <p>And I get this error when I try to run the code:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'Boolean
    IsNullOrWhiteSpace(System.String)' method, and this method cannot be
    translated into a store expression."</p>
  </blockquote>
  
  <p>How can I solve this problem and write code better than this?</p>