The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

GuyBehindtheGuy (2) [Avatar] Offline
#1
The implementation of
IQueryProvider.CreateQuery(Expression expression)
on page 329 is dangerous and wrong. It constructs and returns an IQueryable<object>, disregarding Expression.Type. It is also in stark contrast to Microsoft's recommended implementation:
http://msdn.microsoft.com/en-us/library/bb546158.aspx

This just cost us several days to track down, because it insidiously causes the IQueryProvider implementation to return different results depending on if the generic vs. non-generic CreateQuery method is called.

While I understand that the full (and correct) implementation of CreateQuery may not have fit the spirit of the example (a simple IQueryProvider implementation), there needs to be a comment next to it akin to:
// Don't do this in production code!
jon.skeet (483) [Avatar] Offline
#2
Re: IQueryProvider implementation
Thanks for that - I'm just starting to work on revising chapter 12. Will fix this as I go.

Also added a note: http://csharpindepth.com/ViewNote.aspx?NoteID=160
GuyBehindtheGuy (2) [Avatar] Offline
#3
Re: IQueryProvider implementation
BTW--the book is great, and I recommend it to everyone who interviews with us!