Reputation: 40162
I can do the following:
container.Users.Where(u => u.Name == "Omar").FirstOrDefault()
but
container.Users.FirstOrDefault(u => u.Name == "Omar")
returns a NotSupportedException (The method 'FirstOrDefault' is not supported.)
.
Since these are essentially the same, why is it no supported?
Upvotes: 11
Views: 4478
Reputation: 564323
The LINQ Translation engine used by the OData provider doesn't handle every scenario.
While these are logically the same, the expression for each must be generated to build the query string. The engine doesn't support the second form.
Upvotes: 14