Below code:
var mids = _db.Members
.GroupBy(m => new { m.MemberID, m.CreatedDate })
.Where(m => m.All(s => s.Status == 1) && m.Key.CreatedDate.Date == DateTime.Today)
.Select(m=>m);
I get a run-time error: The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported
When I add _db.Members.AsEnumerable() to the first line it works.
My understanding was that .AsEnumerable() forces the query to execute on the client side. So in the above code AsEnumerable operator break query into 2 parts select on server side and rest on the client side(group by,where).
Can someone validate if my understanding is correct? and why the code failed without .AsEnumerable()?