Reputation: 2181
I'm using the same DAL infrastructure for a console application and a MVC web application and I need to have things configured for InRequestScope in the MVC web application but need to know what the default fallback for InRequestScope is when the OnePerRequestModule hasn't been configured (as would be the case in my console application).
Edit My version of Ninject is 3.0.1.10.
Upvotes: 2
Views: 679
Reputation: 61875
Have a read of the Cache and Collect article by Nate Kohari.
Recent versions of Ninject separate out the OnePerRequestModule
into a Ninject.Web.Mvc
assembly so you wouldn't even be able to see an InRequestScope
extension without working in that context.
For a console app, often you're not working lots of requests coming and going that would need to be Dispose
d, so the default scoping of null
which InTransientScope
[and not specifying a scope] and/or allowing implicit self-registration of classes leads to might be perfectly appropriate. However in general, you're best off figuring out what your unit of work is and explicitly managing when stuff requiring Disposal needs taking care of (as the objects will not be scoped, no Disposal will take place, just Finalizers will kick in [with timing dictated by Murphy's law]).
The scoping section of the wiki is also worth a read on this topic.
Upvotes: 2