我在Spring,Autofac,StructureMap中实现了子容器。我在Spring.NET和Autofac上很成功,但我不能在StructureMap中构建一个子容器。下面的代码应该给我一个子容器。
StructureMap.Container container = new Container();
var childContainer = container.GetNestedContainer();但是它的GetNestedContainer()不会从父容器中拉出任何瞬态对象。有人知道如何为StructureMap容器构建一个子容器吗?
发布于 2013-07-03 15:23:42
这是因为按照设计,StructureMap只从父容器中提取非瞬态对象。
有关使用场景的更多详细信息和示例,请参阅嵌套容器的this explanation。
https://stackoverflow.com/questions/17422092
复制相似问题