Ninject and DataContext disposal

后端 未结 3 1884
南旧
南旧 2021-02-18 14:44

I\'m using Ninject to retrieve my DataContext from the kernel and I was wondering if Ninject automatically disposes the DataContext, or how he handles the dispose() behaviour. F

3条回答
  •  半阙折子戏
    2021-02-18 15:13

    Doesn't look like ninject has any sort of lifetime management. This question sheds more light on it.

    Perhaps you can investigate implementing your own behaviour like shown in this blog. I haven't tried it but maybe you can make something along the lines of per request singleton with the older instance being disposed when the new one is created.

提交回复
热议问题