Only primitive types or enumeration types are supported in this context

前端 未结 3 1742
灰色年华
灰色年华 2020-11-27 07:49

I\'ve seen lots of questions on this topic, but I haven\'t been able to sort through any of them that actually solve the issue I\'m seeing. I have an activities entity that

3条回答
  •  醉酒成梦
    2020-11-27 08:32

    It doesn't like the fact that you're trying to convert a whole object equality into a database query. You can only do entity framework queries using constant values, much like how you would do SQL queries. The way to solve this would be to compare the IDs to see if the AssignedEmployee's ID is the same as the current user's ID in the employee table.

    As a side note, if the currentUser object that you're tracking isn't of the Employee type you might want to consider caching the corresponding Employee record of that user to better be able to reference it in later queries. That would be a lot better than trying to go through that table constantly. (Again this would only affect you if it is, in fact, in a different table)

提交回复
热议问题