i've seen lots of questions on topic, haven't been able sort through of them solve issue i'm seeing. have activities entity tracks employee assigned employee created record , updated it. if remove `where a.assignedemployee == currentuser' line of code, don't run time error below.
unable create constant value of type 'datamodels.employee'. primitive types or enumeration types supported in context.
controller
var query = in db.activities a.assignedemployee == currentuser a.iscomplete == false orderby a.duedate select a; return view(query.tolist());
view
@model ienumerable<data.datamodels.activity> ..........
my guess error indicates ef cannot translate equality operator employee
sql (regardless of whether you're assuming referential equality or overridden ==
operator). assuming employee
class has unique identifier try:
var query = in db.activities a.assignedemployeeid == currentuser.id a.iscomplete == false orderby a.duedate select a; return view(query.tolist());
Comments
Post a Comment