What happens to using statement when I move to dependency injection

前端 未结 2 1166
自闭症患者
自闭症患者 2021-02-07 00:09

I am currently using the following code:

public class MyProvider
{
    public MyProvider()
    {
    }

    public void Fetch()
    {
        using (PopClient po         


        
2条回答
  •  逝去的感伤
    2021-02-07 00:25

    When setting up your bindings, declare the scope:

    https://github.com/ninject/ninject/wiki/Object-Scopes

    Ninject will call dispose on the objects it created for you, so make sure you write up your dispose methods in any objects you give to Ninject to handle.

提交回复
热议问题