I was looking around but couldn't find anything specific for this one. So, I have an async repository, which used to look like:
public object get()
{
var db = new entity(); //i am using EF6
var listOfObjects = db.Object.ToList();
db.Dispose();
return listOfObjects;
}
but now that I'm using async I can't have the dispose there because it hits it before the previous call is being resolved. So my previous method now looks like:
public async Task<Object> GetAsync()
{
var db = new entity();
return await db.Object.ToListAsync();
}
So my question is, when or how should I dispose now?