I have an IConfig
object that contains settings used throughout my application. At the moment, I inject the entire object into the constructor of each object th
You are on the right track:
The Kernel.Get
method is an extension method defined on the ResolutionExtensions
in the Ninject
namepsace so with adding the using Ninject;
it is available in your module as well.
But instead of the Module.Kernel
you should use the IContext
provided in the second overload of WithConstructorArgument
to get the Kernel
:
Bind().To()
.WithConstructorArgument("username",
context => context.Kernel.Get().Username)
.WithConstructorArgument("password",
context => context.Kernel.Get().Password);