且构网

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

AutoFac/.NET Core - 注册 DBcontext

更新时间:2023-02-16 14:24:45

我认为问题在于您正在尝试使用 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.