Ninject: entity object cannot be referenced by multiple instances of IEntityChangeTracker

前端 未结 3 1154
攒了一身酷
攒了一身酷 2021-01-23 07:15

I am starting to use Ninject in my MVC5 code-first app. Here\'s my NinjectWebCommon.cs:

private static IKernel CreateKernel()
    {
        var kernel = new Stan         


        
3条回答
  •  时光取名叫无心
    2021-01-23 07:28

    You're creating a kernel per controller.

    InRequestScope only ensures one instance per request per kernel.

    So you need to adapt your setup of the kernel so there's only one kernel per web application. See:

    • Ninject.Web.Mvc
    • Tutorial
    • Youtube

提交回复
热议问题