efcore
efcore copied to clipboard
Remove DISTINCT inside singleton queries
When a (sub)query results in 0 or 1 elements (First(), Last(), FirstOrDefault(), LastOrDefault(), Take(0/1), ...), DISTINCT has no effect and can be removed.
Conceptually this is a continuation of #31016
Makes sense, thanks @ranma42.