This question has already been answered:
Hello, I created a console application with the entity framework. To load data using the principle of lazy load. And it works if you write like this:
Context db = new Context(); var teams = db.Teams.ToList(); foreach(Team t in teams) { Console.WriteLine("Team named is {0} ", t.Name); foreach(Player p in t.Players) Console.WriteLine("In team {0}, have player {1}", t.Name, p.Name); } Console.ReadKey(); That is, I am loading a list of commands in the Varovsk variable, and everything is pulled to it. And when I go through everything in the loop, all the rules, but if I load not the sheet, but iqueryable, then there is this: var teams = db.Teams; In this case, there will be an error: 
Please explain why this is happening? Why can't I get a collection of players from this kind of data?
Существует назначенный этой команде Command открытый DataReader, который требуется предварительно закрытьin advance in the innerexception, which means I cannot understand. - AndreiНеобходимо материализовать ваш запрос в любую коллекцию.Пока вы не материализовали коллекцию, ваш запрос не выполнен и соответственно ридер не закрыт- tym32167