I' using EF 4, I have a property DateTimeStart
in my entities with datein this format 16/08/2012 08:14:40
, I would like query with EF and find all the entities within the date 16/08/2012 only
. Using this code below code I receive this error
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
my code
DateTime dateTimeNow = DateTime.UtcNow;
DateTime dateNow = dateTimeNow.Date;
return db.EventCustoms.Where(x => x.DataTimeStart.Date <= dateNow)
.Select(y => new { y.EventId, y.EventTitle, y.DataTimeStart });