ObjectQuery<T>::Distinct Method ()
.NET Framework (current version)
Limits the query to unique results.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
Return Value
Type: System.Data.Objects::ObjectQuery<T>^A new ObjectQuery<T> instance that is equivalent to the original instance with SELECT DISTINCT applied.
This query builder method returns an ObjectQuery<T> instance that is equivalent to the original query with SELECT DISTINCT applied.
The DISTINCT operator cannot be applied to an object that includes a mapping to a non-comparable column in the data source (such as ntext).
The example in this topic is based on the AdventureWorks Sales Model. The example uses UnionAll method to create a new ObjectQuery<T> object. Then it calls Distinct on the new ObjectQuery<T> object to get the unique results of this query.
.NET Framework
Available since 3.5
Available since 3.5
Show: