LINQ, Unable to create a constant value of type XXX. Only primitive types or enumeration types are supported in this context

前端 未结 5 628
我寻月下人不归
我寻月下人不归 2020-11-30 01:58

In my application I have Lecturers and they have list of Courses they can teach and when I\'m deleting a course I want to remove connection to lecturers. Here\'s the code:

5条回答
  •  攒了一身酷
    2020-11-30 03:03

    The Courses collection of below line should be null or empty.

     var toRemove = db.Lecturers
                            .Where(l => l.Courses.Contains(courseFromDb)).ToList();
    

提交回复
热议问题