最近、ASP.NET MVC 3 アプリを Ninject 2.2 に更新しました。
以前は、メイン アプリに実装バインディングへの次のインターフェイスがありました。
Bind(typeof(IMyInterface<>)).To(typeof(MyImplementation<>)).InRequestScope();
さらに、メイン アプリによって読み込まれている別のアセンブリに次のものがありました。
var arg = new ConstructorArgument("info", "something");
Bind<IMyInterface<MyClass>>().To<MyImplementation<BlogComment>>().WithParameter(arg);
これは以前は正常に機能し、より具体的な実装 (引数を持つもの) が認識されていました。ただし、Ninject 2.2 にアップグレードすると、次のエラーが発生しました。
Error activating IMyInterface{MyClass}
More than one matching bindings are available.
Activation path:
2) Injection of dependency IMyInterface{MyClass} into parameter myParam of constructor of type SomeOtherClass
1) Request for IMyInterface
Suggestions:
1) Ensure that you have defined a binding for IMyInterface{MyClass} only once.
これを引き起こしている 2.0 から 2.2 への変更と回避策はありますか?