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

You can’t use Contains with non-primitive values. Do

Where(l => l.Courses.Select(c => c.CourseId).Contains(courseId)

(or the Id field you use).

Leave a Comment