Exec summary: No, you don't need to do anything in the web.config
.
You could manually sanity check by:
- Binding something
IDisposable
.InRequestScope()
- adding it to the ctor of a Controller
- attaching a debugger, put a breakpoint in
void Dispose()
- manually triggering a
HttpRequest
If you hit the Dispose
, it woz Ninject that shot the bear (and you'll have a call stack to prove it).
What wires it it? The Ninject.Web.Common
NuGet package adds:
public static class NinjectWebCommon
{
public static void Start()
{
...
DynamicModuleUtility.RegisterModule( typeof( OnePerRequestHttpModule ) );
DynamicModuleUtility
is from Microsoft.Web.Infrastructure
(and the call to the Start
method is driven by:
[assembly: WebActivator.PreApplicationStartMethod( typeof( App_Start.NinjectWebCommon ), "Start" )]
(Which comes from the WebActivator
NuGet package)
Speaking pedantically, the docco sayssaid:
To get more deterministic behavior, you can do any of the following:
...
Use the Ninject.Web.Common extensions that register the OnePerRequestModule for you.
...
You can register
(my emphasis). I'll make it more explicit...
BTW at the start of the exercise of answering this question, I had no special knowledge, just the source to Ninject
Ninject.Web.Common
and one of my apps.