I have an EF Core program.
Code
class EagerLoading
{
public async void load()
{
Console.WriteLine("a");
var teams = await loadTeamsAsync();
Console.WriteLine("c");
}
public async Task<List<Team>> loadTeamsAsync()
{
Console.WriteLine("b");
using (var context = new SchoolContext())
{
return await context.teams.
ToListAsync();
}
}
}
//Entry method
static void Main(string[] args)
{
new EagerLoading().load();
}
Output
a
b
Expected
a
b
c
Question
where am I wrong? why the Console.WriteLine("c"); doesn't execute?