I have an entity like the following :
class Serial {
public int Id { get; set; }
public string No { get; set; }
}
what I have to get is a list of serials by a list of serial ids, but continuously I get the error :
Unable to create a constant value of type ProjectName.Models.Serial. Only primitive types or enumeration types are supported.
this is what I've written so far :
List<Serial> serials = _ctx.Serials.Where(s => sList.Any(ss => ss.Id == s.Id)).ToList();
and
List<Serial> serials = _ctx.Serials.Where(s => sList.Select(ss => ss.Id).Contains(s.Id)).ToList();