Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the 'it' in Entity Framework and EntityDataSource examples?

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

like image 434
Steve Davies Avatar asked Oct 15 '22 18:10

Steve Davies


1 Answers

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 :(

like image 195
Jon Skeet Avatar answered Oct 18 '22 22:10

Jon Skeet