想象一下两张桌子:Shifts,RANK_S_DAY.移位包含一个ShiftDate列,它是DateTime,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理解的东西,任何想法?
这是代码:
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;