ASP.NET MVC, Ninject, single instance per request for multiple constructors

前端 未结 1 1381
情书的邮戳
情书的邮戳 2020-12-30 03:42

Im trying to implement an unit of work pattern by passing an unit of work instance into my repositories.

Relevant code from Global.asax.

public class         


        
1条回答
  •  有刺的猬
    2020-12-30 04:00

    The code you have will work fine. Only one instance of IUnitOfWork will be given to any class that requests it (via constructor/property injection or calls to the kernel's .Get<> etc.)

    0 讨论(0)
提交回复
热议问题