 <p>PROBLEM: "&amp;&amp;" and "||" is converted to a method like "AndCondition(a, b)", so "!a.HasValue || a.Value == b" becomes "OrCondition(!a.HasValue, a.Value == b);" The reason for this is probably to get a generic solution to work for both code and SQL statements. So instead, use the "?:" notation.</p> <p>For more, see my blog post: <a href="http://peetbrits.wordpress.com/2008/10/18/linq-breaking-your-logic/" rel="nofollow noreferrer">http://peetbrits.wordpress.com/2008/10/18/linq-breaking-your-logic/</a></p> <pre><code>// New revised code. public static int NumberUnderReview(int? ownerUserId, List&lt;int&gt; ownerGroupIds) { return ( from c in db.Contacts where c.Active == true &amp;&amp; c.LastReviewedOn &lt;= DateTime.Now.AddDays(-365) &amp;&amp; ( // Owned by user // !ownerUserId.HasValue || // c.OwnerUserId.Value == ownerUserId.Value ownerUserId.HasValue ? c.OwnerUserId.Value == ownerUserId.Value : true ) &amp;&amp; ( // Owned by group // ownerGroupIds.Count == 0 || // ownerGroupIds.Contains( c.OwnerGroupId.Value ) ownerGroupIds.Count != 0 ? ownerGroupIds.Contains( c.OwnerGroupId.Value ) : true ) select c ).Count(); } </code></pre>