title: The specified cast from a materialized 'System.Int32' type to the 'System.Double' type is not valid
body: <p>When executing the following query, I get the error:</p>
  
  <blockquote>
    <p>The specified cast from a materialized 'System.Int32' type to the
    'System.Double' type is not valid.</p>
  </blockquote>
  
  <pre><code>var data = ctx.tblTO
                     .Where(m =&gt; m.Id == Id)
                     .GroupBy(m =&gt; m.EmployeeId)
                     .Select(m =&gt; new
                     {
                         workDay = m.Sum(k =&gt; k.WorkDay),
                         onDutyDay = m.Sum(k =&gt; k.OnDutyDay),
                         holiDay = m.Sum(k =&gt; k.Holiday)
                     })
                     .FirstOrDefault();
  </code></pre>
  
  <p>The datatype of <code>WorkDay</code>, <code>OnDutyDay</code> and <code>Holiday</code> is <code>double</code>. There is no <code>Int32</code> here, so why do I get this error?</p>
  
  <p>How can I solve this error?</p>
  
  <pre><code>public class TO
  {
      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }           
      public int EmployeeId { get; set; }
      public double WorkDay { get; set; }
      public double OnDutyDay { get; set; }
      public double Holiday { get; set; }
  }
  </code></pre>