We've all heard of the factory pattern, right? Well, Ninject is kind of like a "super factory", in that it knows how to create all sorts of objects, based on hints that you provide.
我们已经对工厂模式有所耳闻,而Ninject就类似于某种“超级工厂”,它知道如何根据你提供的提示,创建所有类型的对象。
In the latter case, the component USES the Factory design pattern to look up the default formatters for the class of the specified value.
在后一种情况下,组件用工厂(Factory)设计模式来查找指定值类的缺省格式化器。
Listing 6 creates a Field using the Factory pattern in the Layout class.
清单6用工厂模式,在Layout类中创建了Field。
应用推荐