865 votes25 comments · [Closed] Entity Framework Core Feature Suggestions · Flag idea as inappropriate… · Admin →
Issue tracking this feature: https://github.com/aspnet/EntityFramework/issues/1833.Mike commented
You may be able to workaround this by flipping around your query for Linq to Entities, then flipping it back with Linq to Objects. Using the example above:
var q = context.Products.Where(p => p.UnitPrice > 20 & p.Category.StartsWith("a")).Include(p => p.Category);
var r = q.ToList().Select(p => p.Category).Distinct();
Note: This would not work if you are expecting Categories that don't have products in your results.
101 votes7 comments · [Closed] Entity Framework Core Feature Suggestions · Flag idea as inappropriate… · Admin →
Reopening since this was originally completed for EF6 and is possible but not easy in Entity Framework Core.