私はこのようなクラスを持っています:
public class MyClass
{
public MyClass()
{
this.Dependency = new Dependency(this);
}
}
new Dependency()
呼び出しをコンストラクターに移動したい。
public class MyClass
{
public MyClass(IDependency dependency)
{
this.Dependency = dependency;
}
}
IDependency
「this」コンストラクター引数で が作成されるようにバインドする方法がわかりません。
Bind<IDependency>()
.To<Dependency>()
.WithConstructorArgument("myClass", ctx => ctx.???); // How do I do this?