且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AutoFac/.NET Core-注册DBcontext

更新时间:2023-02-16 14:19:54

我认为问题是您正在尝试使用AsImplementedInterfaces()注册MyContext().通常,这不是DbContext的注册方式.您应该注册并解析类本身.

I think that the problem is that you're trying to register MyContext() using AsImplementedInterfaces(). This is not how DbContext are getting registered usually. You should register and resolve class itself.