Log in

Subscribe to site updates.

IQueryable on In-Memory Objects

Posted by Nicholas Blumhardt | November 22, 2007 21:31

Does anyone out there know where Enumerable.ToQueryable() from the early LINQ previews went?

I'm keen to mock IQueryable<T> to test some queries and would like to adapt an IEnumerable<T> for the purpose - implementing this by hand looks like a pain - surely there is an implementation provided with the BCL..?

If not, I guess you can expect to see some 'writing a pointless and trivial IQueryable provider'-type articles in this space :)

Comments

Posted by Luke Marshall | November 23, 2007 11:25

I think it got axed in favour of AsEnumerable<T>() - Which really doesn't help you at all. :) If you are trying to mock a Linq DataContext, you should be able to replace the tables with a collection behind the scenes.

Found it!!!

Posted by Nicholas Blumhardt | November 30, 2007 20:36

For some bizarre reason it wasn't showing up - System.Linq.Queryable provides an extension method for the job. I was looking at Enumerable expecting that is where all of the extension methods for IEnumerable would be found :) Combine that with a missing using statement and a late night... Silly silly :)

Your Comment





Reset

Disclaimer: These articles represent the opinions of the authors and may not match the official position of Ubik Systems Pty. Ltd. Confirmation should be sought on all matters involving professional advice.