Update 2013-08-22:
After having a look at the \'Building an IQueryable provider series\' (thanks for the link!) I got a bit further. I updated the c
By now I found out why I received an exception every time the query has been enumerated: The IQueryable infrastructure of the Entity Framework is implemented very differently from the pattern described in Building an IQueryable provider series, pt. 1.
The blog post suggests to implement GetEnumerator() by calling Execute() on the provider.
In contrast, in the EF infrastructure, ObjectQueryProvider's Execute() method only accepts expressions which return a single result object -- but not an enumerable collection of result objects (this is even documented in the source code). Accordingly, ObjectQuery's GetEnumerator() method does not call Execute() but another method getting the result right from the database.
Thus, any translating IQueryable implementation which uses an underlying database query to get the objects must use the same pattern -- the translating GetEnumerator() method just calls GetEnumerator() on the underlying database query and injects this into a new TranslatingEnumerator.