views:

1316

answers:

1

Dumb question I'm sure, but why does Entity Framework EntityDataSource object require the where clause to contain 'it' as the first part of the object selector?

The documentation for the where clause (http://msdn.microsoft.com/en-us/library/cc488531.aspx) states that the string is passed directly to the ObjectQuery(T), so I should be able to pass in (for example) "x.OnlineOrderFlag = TRUE" where x is anything that makes sense in a predicate, however the clause only works if I pass in "it.OnlineOrderFlag = TRUE"

All of the Microsoft examples use 'it' so what am I missing?

Steve Davies

+3  A: 

It looks like "it" is just an implicit parameter name. In query expressions this is provided by the range variable, but you don't specify the parameter name in the call to Where, so it looks like it just uses "it" implicitly.

I agree that it's poorly documented though :(

Jon Skeet
Thanks for the quick reply Jon, using 'it' feels like writing beginner code ... "_myControl = new Control" etc oh well! Steve
Steve Davies
I think this goes with the whole Entity Framework. I think I will go google for that "Vote of No Confidence" from the Alt.Net guys. :)
BobbyShaftoe