I am new to Entity Framework. I am trying to write select query in EF which selects distinct columns from a view. I am using following code
List<ClientDTO> oClients = new List<ClientDTO>();
oClients = (from p in context.vwClients
where (p.ClientNumber == ClientNumber) && p.isDeleted == true
select new ClientDTO
{
ClientNumber = p. ClientNumber,
IncomeClassId = p.IncomeClassId,
FullClientName = p. FullClientName,
CountryId = p.CountryId,
ProductId = p.ProductId,
ProductName = p.ProductName,
ProductShortName = p.ProductShortName,
isDeleted = p. isDeleted
}).OrderBy(x => x. FullClientName).Distinct().ToList();
It still returns duplicate rows. When I write the SQL query with distinct on all columns, it does return distinct rows.
Is there any way to get distinct of all columns used in above code?