Can I specify the scope in Ninject for only this specific situation?

前端 未结 1 1286
轻奢々
轻奢々 2021-01-18 18:27

Earlier I asked this question. The answer to which resulted into another question like thou seeth before thee.

The initial problem

My problem is, that I ha

相关标签:
1条回答
  • 2021-01-18 18:51

    The .InRequestScope() bit is causing some of your objects to be Disposed (see Cache and Collect).

    You need to make this (scoping by request) not happen in your provisioning of your provider's dependencies.

    One way to achieve that is by having two bindings - one for the request processing branch and one for the global context, i.e., adding a When... which uses the context.ParentContext... chain to control whether it's InRequestScope() or not

    Sadly I don't have time to give a full answer now and the relevant docs are out of sync with the code at present.

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