On the following code I am getting an exception
var ret = db.Especialidades.Except(sol.EspecialidadesExigidas).ToList();
This is the Exception
Unable to create a constant value of type 'TCC.Models.Especialidade'.
Only primitive types or enumeration types are supported in this context.
I have looked into other similar questions and tried to adapt their answers, but to no success. Other atempts made:
var ret = (from e in db.Especialidades where !sol.EspecialidadesExigidas.Any(e2 => e2.Id == e.Id) select e).ToList();
var ret = (from e in db.Especialidades where !sol.EspecialidadesExigidas.Select(e2 => e2.Id).Contains(e.Id) select e).ToList();
What I am trying to do is to get all "Especialidades" from the database that`s not included in the list