I have this EF 6 query:
var semana = servicio.Semana.Where(s => s.SemanaDia.Equals(ds.Dia)).FirstOrDefault();
Where ds.Dia
is an integer an equal to 2. servicio
is an entity and semana
is a related table.
When debugging, I see that servicio.Semana
contains a value that matchs the criteria, however, that query returns null
.
If I replace .Equals
by ==
, the record is retrieved and assigned to semana
variable.
What may be the explanation to this?
SemanaDia
is also an integer in the database.