I've seen other questions similar to this but none close enough to help me figure this out. I'm getting the error here in my repository:
return await Context.Database.SqlQuery<MemberField>(sqlstring).ToListAsync();
How do I fix this? It has worked before without any changes to code so I know all I have to do is keep the context alive. I tried doing this:
Context.Configuration.LazyLoadingEnabled = false;
but it didn't help. This is inside an ASP.NET boilerplate project.
Thanks!
in the constructor I have:
public MyRepository(IDbContextProvider<MyDbContext> dbContextProvider) : base(dbContextProvider)
Then I have a AbpDbContext class:
public class MyDbContext : AbpDbContext{
public MyDbContext() : base("Default"){}
public MyDbContext(string nameOrConnectionString) : base(nameOrConnectionString){}
}
You can grab a template solution just like the project I'm trying to work with from here: http://www.aspnetboilerplate.com/
Update: ABP handles creating and disposing database connections so I don't have any code to show that does that.