title: Unable to cast the type 'System.Int64' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types
body: <p>I have created a <strong>EF 4</strong> &amp; <strong>C#</strong> to get some data. I am using Linq. Its as follows:</p>
  
  <pre><code>    public List&lt;object&gt; GenerateCallTrackingReport(int startRowIndex, int maximumRows, int createdByID)
      {
          var query = from c in this.ObjectContext.CallLogs                        
                      select new
                      {
                          CallLogID = c.CallLogID,
                          DomainName = c.CallDomain.FullName,
                          CreatedByID = c.CreatedByID,
                          CreatedBy = c.CreatedByUser.FirstName + " " + c.CreatedByUser.LastAccessIPN,
                          CalledOn = c.CallDate,
                          IssueResolutionTime = c.IssueResolutionTime,                            
                          CallType = c.CallType.FullName,
                          CallDescription = c.CallDescription,
                          CustomerName = (c.CustomerID &gt; 0 ? c.Customer.FirstName + " " + c.Customer.LastAccessIPN : c.TempCaller.FirstName + " " + c.TempCaller.LastName),
                          CustomerEmail = (c.CustomerID &gt; 0 ? c.Customer.Email : string.Empty),
                          CustomerResponse = c.Response.FullName,
                          IsPending = c.IsPending,
                          NeedFurtherContact = c.NeedFurtherContact
                      };
  
          if (createdByID &gt; 0)
              query = query.Where(c =&gt; c.CreatedByID == createdByID);
  
          if (maximumRows &gt; 0)
              query = query.Skip(startRowIndex).Take(maximumRows);
  
          return query.ToList&lt;object&gt;();
  
      }
  </code></pre>
  
  <p>This is causing the following error:</p>
  
  <pre><code>Unable to cast the type 'System.Int64' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
  </code></pre>
  
  <p>Any Idea y am i getting this error??</p>
  
  <p>Thanks</p>