我使用StructureMap实现了一个接口注入,如下所述。
ObjectFactory.Initialize(x => { x.For<*IRepository*>().Use<*SQLRepository*>(); });但它发出了如下警告
警告2 'StructureMap.ObjectFactory‘已经过时了:'ObjectFactory将在StructureMap的未来4.0版本中删除。请在以后的工作中使用容器类’。
如何使用Container纠正此问题?
发布于 2015-06-09 04:43:09
您可以根据容器的文档直接创建容器的实例。语法相对类似。
var container = new Container(x =>
{
x.ForRequestedType<IRepository>().Use<SQLRepository>();
});https://stackoverflow.com/questions/30723136
复制相似问题