aspnet/EntityFramework — pull request #1261 by maumar (2014-12-10 02:28:34+00:00)
Title: Fix to issue 1220 - Queries with join and count (or other result operators) were broken.

Problem was in the result operator translation, where we tried prune CreateValueReader and CreateEntity calls - replace it with the reader that we get from the database query. We should remove the first (outermost) occurrence of CreateValueReader/CreateEntity, but instead we were removing the innermost one. Reason for that is that we were matching it based on source scope that was passed to the visitor and we were passing the incorrect one. Fix is to pass the correct query scope (i.e. one that would match the outermost CreateValueReader/CreateEntity node).

@ajcvickers @AndriySvyryd @divega