You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The distinct is not translated into sql when used after a Select(x => new Type {}).
The distinct is well translated with an anonymous type Select(x => new {}).
Steps to reproduce
publicclassThirdParty{publicintThirdPartyId{get;set;}publicstringName{get;set;}publicstringNormalizedName{get;set;}}publicclassMyDataContext:DbContext{publicDbSet<ThirdParty>ThirdParties{get;set;}}publicclassDTOTP{publicStringNormName{get;set;}}//The following fails: no distinct in the sql query (no effect at all in fact, distinct is totally ignored)return_ctx.ThirdParties.Where(x =>(x.NormalizedName??x.Name).Contains(qName)).Select(x =>newDTOTP{NormName=x.NormalizedName??x.Name}).Distinct().OrderBy(x =>x.NormName).ToList();//The following runs: Distinct() is translated in the sql query emittedreturn_ctx.ThirdParties.Where(x =>(x.NormalizedName??x.Name).Contains(qName)).Select(x =>new{NormName=x.NormalizedName??x.Name}).Distinct().OrderBy(x =>x.NormName).ToList().Select(x =>newDTOTP{NormName=x.NormName}).ToList();
Further technical details
EF Core version: 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: windows 10
IDE: Visual Studio 2015
The text was updated successfully, but these errors were encountered:
The distinct is not translated into sql when used after a
Select(x => new Type {})
.The distinct is well translated with an anonymous type
Select(x => new {})
.Steps to reproduce
Further technical details
EF Core version: 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: windows 10
IDE: Visual Studio 2015
The text was updated successfully, but these errors were encountered: