我正在尝试从Structuremap 2.6.4.1迁移到3.1.4.143,但我无法弄清楚如何处理HybridHttpOrThreadLocalScoped。我找不到任何SO Q / A似乎对我有用......
我有以下代码:
using StructureMap;
using StructureMap.Web;
ObjectFactory.Configure( x =>
{
x.For<IRepository<Person>>()
.HybridHttpOrThreadLocalScoped() // Need the repo to survive for the duration of the thread!
.Use<Repository_Stub<Person>>()
.Ctor<IEnumerable<IEntity>>( "seed" ).Is( persons );
} );
给了我这个错误:
'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression<IRepository<Person>>'
does not contain a definition for 'HybridHttpOrThreadLocalScoped' and no extension method
'HybridHttpOrThreadLocalScoped' accepting a first argument of type
StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression<IRepository<Person>>'
could be found (are you missing a using directive or an assembly reference?)
有没有新方法可以调用HybridHttpOrThreadLocalScoped?
Thansk提前!
答案 0 :(得分:4)
HybridHttpOrThreadLocalScoped
已移至名为Structuremap.Web
的单独nuget包中。
可以通过在Nuget Package Console中运行Install-Package structuremap.web
来安装它。
See this post了解更多信息。