I'm having something like this:
class Root
{
public Root(IDependency dep)
{}
}
class Dependency:IDependency
{
public Dependency(int val)
{}
}
And I'm trying to obtain a reference to Root using ninject.
So i configure it like this
var module = new InlineModule(mod => mod.Bind<IDependency>().To<Dependency>());
var kernel = new StandardKernel(module);
I'd like to inject into Dependency some 'val' value that is known only at the moment of obtaining the Root reference from ninject.
What i'd like to do is something like this:
Kernel.Instance.Get<Root>(With.Parameters.ConstructorArgument("val", 12));
Is something like this possible using ninject 1.0?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…