The specified type member ‘Date’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties

Fungsi komparasi Date pada Linq dapat menimbulkan error seperti tertulis di judul. Solusinya dengan menggunakan fungsi TruncateTime

[code language=”csharp”]
var eventsCustom = eventCustomRepository.FindAllEventsCustomByUniqueStudentReference(userDevice.UniqueStudentReference)
.Where(x => DbFunctions.TruncateTime(x.DateTimeStart) == currentDate.Date);
[/code]

http://stackoverflow.com/questions/14601676/the-specified-type-member-date-is-not-supported-in-linq-to-entities-only-init

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>