C# in Depth

Cover of C# in Depth
Order now (3rd edition)

Use the expression type in CreateQuery!

Chapter 12: LINQ beyond collections: P329, listing 12.7

Created: 1/7/2010
Last updated: 10/19/2010
Severity: Technical error

In the nongeneric implementation of IQueryProvider.CreateQuery, I'm ignoring the type of the expression and always returning a FakeQuery<object>. Instead, it should return a query based on expression.Type. The easiest way to do this is probably to call the generic method via reflection, or call the FakeQuery<T> constructor directly with Activator.CreateInstance.