I want to remove duplicate records using Entity Framework.
This is what I've tried
var result = _context.History
.GroupBy(s => new
{
s.Date,
s.EventId
})
.SelectMany(grp => grp.Skip(1)).ToList();
_context.History.RemoveRange(result);
await _context.SaveChangesAsync();
But I get an error
System.InvalidOperationException: Processing of the LINQ expression 'grp => grp.Skip(1)' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core
I understand that this is breaking change for Entity Framework, but I really don't know how to update my code.