【发布时间】:2011-01-24 16:11:01
【问题描述】:
考虑以下几点:
public Something(IInterface concreteObjectOne, IInterface concreteObjectTwo)
{
this.concreteObjectOne = concreteObjectOne;
this.concreteObjectTwo = concreteObjectTwo;
}
如何使用 Ninject 设置这种类型的绑定?我会尝试用谷歌搜索这个词,但由于我不确定这叫什么,所以我不能,也无法在 Wiki 上找到任何关于此的内容。
编辑:
我相信这称为基于约定的绑定,如 here 所述。但是,此文档适用于 1.0 版,而 2.0 版没有 Only 方法。我希望在没有属性的情况下实现这一点 - 使用名称约定或类似的东西。
【问题讨论】:
标签: c# binding ioc-container ninject