When using custom Distinct operator on SQL data source you are going to see “Unsupported overload used for query operator 'Distinct'” exception. Basically it’s because Linq to SQL doesn’t support custom operators. One way to overcome this problem is forcing immediate query evaluation by using for example ToList() method.

Ex. before:

db.SomeTable.Distinct(new CustomComparer())

After:

db.SomeTable.ToList().Distinct(new CustomComparer())
posted on Friday, November 27, 2009 8:25 PM |

Feedback

# re: Unsupported overload used for query operator 'Distinct'

Gravatar Thanks. 5/19/2010 10:37 PM | AC

# re: Unsupported overload used for query operator 'Distinct'

Gravatar Simple. Thanks. 2/14/2011 10:14 PM | phil

Comments have been closed on this topic.
About
Dawid Kowalski Dawid Kowalski is software developer, traveler and strong advocate of "let's go do it".


Recent Posts
Recent Comments
Twitter
Syndication
Hosted by