I recently have a project with MVC 4, .NET 4.5 and using EF 5.0 (Database First) using the EF 5.0 DbContext Generator. I then upgraded through Nuget Manager to EF 6.0 alpha 2. I wanted to use the new async patterns but for some reason I dont have .ToListAsync() available. I am referencing the context in a similiar fashion:
public class HomeController : Controller
{
TestContext db = new TestContext();
public async Task<ActionResult> Index()
{
var keywords = await db.Keywords.ToListAsync();
return View(keywords);
}
}
Is this not available in Database First, and only available in Code First? How can I make something like the example above work? I am using SQL Azure.
Async. extension methods are defined in EF related
System.Data.Entity.IQueryableExtensionsstatic class. So you must add:at the beginning of your controller class file to be able to call them.