I have following code running on EF7 Beta 8:
var locationGrops = from l in db.Locations
group l by l.ServiceType into g
select g;
var list = locationGrops.ToList();
When I execute this code, EF displays a warning.
warning : [Microsoft.Data.Entity.Query.QueryCompilationContext] The LINQ express
ion 'GroupBy([l].ServiceType, [l])' could not be translated and will be evaluate
d locally.
The query seems quite basic to me and there is GROUP BY in SQL. Is there any way to make it run on a server?
You can use context.Locations.FromSql(sql).ToList()
to ensure your query is run as you desire on the server.
At this time group by
and and most subqueries are not supported by EF7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With