1
私はNinject
DIコンテナを使用しています。そして、私はその後2ジェネリック型を制約でバインドする方法
public interface IRepository<T> where T : AbstractEntity<T>, IAggregateRoot
{
// methods signatures
}
public class Repository<T> : IRepository<T> where T : AbstractEntity<T>, IAggregateRoot
{
// implementations
}
を持っている私は、this.Bind<IRepository<>>().To<Repository<>>();
を文として認識されていない別のモジュール
public class DataAccessModule : Ninject.Modules.NinjectModule
{
public override void Load()
{
this.Bind<IRepository<>>().To<Repository<>>();
}
}
でそれらをバインドしようとしています。
バインドを行うにはどうすればよいですか?
可能複製(http://stackoverflow.com/questions/2216127/ninject-with-generic-interface) – nawfal