title: Linq: Sum of int
body: <p>I am getting "<strong>The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type</strong>" When executing Sum() of my empty statement.
  ResultView works fine, but either</p>
  
  <pre><code>var r = from v in DataContext.Visits
          join bs in DataContext.BaseContents on v.BaseContentID equals bs.Id
          where (bs.CreatedBy == userId) &amp;&amp; (v.DateVisited.Year == workDate.Year) &amp;&amp;
          (v.DateVisited.Month == workDate.Month) &amp;&amp; (v.DateVisited.Day == workDate.Day) &amp;&amp;
          (v.IsPreviewed == false) &amp;&amp; (bs.ProfileProjectId != null)
          select v;
  
  int? number = r.Sum( v =&gt; v.Counter);
  </code></pre>
  
  <p>either</p>
  
  <pre><code>var r = from v in DataContext.Visits
          join bs in DataContext.BaseContents on v.BaseContentID equals bs.Id
          where (bs.CreatedBy == userId) &amp;&amp; (v.DateVisited.Year == workDate.Year) &amp;&amp;
          (v.DateVisited.Month == workDate.Month) &amp;&amp; (v.DateVisited.Day == workDate.Day) &amp;&amp;
          (v.IsPreviewed == false) &amp;&amp; (bs.ProfileProjectId != null)
          select v.Counter;
  
  int? number = r.Sum(v);
  </code></pre>
  
  <p>fails with same exception.</p>