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())
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