How to SELECT WHERE NOT EXIST using LINQ?

前端 未结 5 801
余生分开走
余生分开走 2020-12-13 23:33

I have to list all \"shift\" data to be assigned to an \"employee\" but shift data must not be included if it is already existing in employ

5条回答
  •  -上瘾入骨i
    2020-12-13 23:52

    The outcome sql will be different but the result should be the same:

    var shifts = Shifts.Where(s => !EmployeeShifts.Where(es => es.ShiftID == s.ShiftID).Any());
    

提交回复
热议问题