I need some help using a lambda expression to remove duplicate entries in my Entity Framework context. I have a table with the following columns:
Id, DateOfIncide
var query = db.Incidents.Where(x => x.IsAttendanceIncident == "Y")
.GroupBy(x => new { x.Id, x.EmployeeId, x.DateOfIncident, x.IsAttendanceIncident })
.Select(x => x.FirstOrDefault());
var query2 = from duplicate in db.Incidents
.Where(x => x.IsAttendanceIncident == "Y" && !query.Any(i => i.Id == duplicate.Id));
query2 will now just contain the duplicates?