Entity Framework select distinct name

patrick picture patrick · Dec 27, 2010 · Viewed 207.3k times · Source

How can I do this SQL query with Entity Framework?

SELECT DISTINCT NAME FROM TestAddresses

Answer

py2020 picture py2020 · Dec 27, 2010

Using lambda expression..

 var result = EFContext.TestAddresses.Select(m => m.Name).Distinct();