c# - Date Comparison In Entity Framework Linq Query -
i trying compare dates in entity framework 6 linq query.
var bookings = context.bookings.include("bookingitems").where(x=>x.isdeleted == false && datetime.compare(dbfunctions.truncatetime(x.bookingdate).value,datetime.now.date)==0).tolist();
however resulting in exception:
"the specified type fellow member 'date' not supported in linq entities. initializers, entity members, , entity navigation properties supported."
i want compare dates trimming time part.
any suggestions how can done?
linq can't translate native .net code sql seek utilize datetime.now function , other .net function outside linq query , reference in query.
string currenttime = datetime.now.toshortdatestring(); var bookings = context.bookings.include("bookingitems").where(x=>x.isdeleted == false && datetime.compare((x.bookingdate).value.date,currenttime)==0).tolist();
i haven't run though there might syntax error, seek anyway
c# entity-framework
No comments:
Post a Comment