This is a migrated thread and some comments may be shown as answers.

LINQ query with Distinct() throws error

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 11 Jul 2012, 06:37 PM
Hi all,
I'm trying to bind a LINQ query that has a Distinct() in it and bind it to a Grid (this is the Telerik grid still, haven't converted to Kendo yet). I've tried adding AsQueryable() to it also, but still getting a "Specified method is not supported exception."

My query looks like this:

var rewardTypes = (from type in _rewardTypeRepository.GetAll()
                               from vo in type.ValidOutlets
                               join ot in _outletRepository.GetAll()
                                   on vo.Outlet.Id equals ot.Id
                               where userOutletIds.Contains(ot.Id)
                               select vo.RewardType).Distinct().AsQueryable();

Any ideas or guidance on this would be greatly appreciated.

Thank you,
Matt

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 12 Jul 2012, 03:26 PM
Hello Matt,

I am not sure if the error is directly related to the Grid. Does the same error appear if you append the ToList() extension method to your query ?

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or