I am getting an error saying linq to entities does not know about the .Date
operator in the following query:
var data = from p in page_loads
join f in sites
on p.site_id equals f.id
join tr in test_runs
on p.test_run_id equals tr.id
where f.id == 17
group p by p.created_at.Date into g
select new { time = g.Average(t => t.time), created_at = g.Key };
Note: created_at
is NOT NULL
in the database. I am pointing this out because I know that created_at is not nullable and linq to entities would have issues with that. But I don't know how to fix this issue.
Edit:
[EdmScalarProperty(EntityKeyProperty = false, IsNullable = false)]
[DataMember]
public DateTime created_at { get; set; }