假设有两个表:Shifts和RANK_S_DAY。Shifts包含一个DateTime类型的ShiftDate列,而RANK_S_DAY具有一个DayOfWeek列。我需要连接(int)ShiftDate.DayOfWeek等于DayOfWeek。我知道为什么它不起作用,但我不确定该如何改变它。异常是:
"The specified type member 'DayOfWeek' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
据我所知,LINQ无法将(int)ShiftDate.DayOfWeek转换为SQL可以理解的内容。有什么想法吗?
以下是代码:
"The specified type member 'DayOfWeek' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
据我所知,LINQ无法将(int)ShiftDate.DayOfWeek转换为SQL可以理解的内容。有什么想法吗?
以下是代码:
Shifts = from s in en.Shifts
join j in en.RANK_S_JOB on s.kronos_JobPositions.JobID equals j.JOBNO
join d in en.RANK_S_DAY on (int)s.ShiftDate.DayOFWeek equals d.DAY_OF_WEEK
orderby
d.RANK,
j.RANK ascending
select s;