If you install the nuget Ninject package for mvc, it puts a NinjectWebCommon.cs
file in the App_Start folder.
I understand 99% of the stuff in this file apart from this line:
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
Full code file here on GitHub
In my mind, it would be better to use:
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => bootstrapper.Kernel);
As the static instance is already defined at the top of the file, and thus it will get the kernal that has all the mappings built.
After some googling it seems this is also common:
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => ctx.Kernel);
What is the reasoning behind the way the boilerplate code is the way it is?