3

我正在尝试从 Structuremap 2.6.4.1 迁移到 3.1.4.143,但无法弄清楚如何处理 HybridHttpOrThreadLocalScoped。没有一个 SO Q/AI 可以找到似乎对我有用......

我有以下代码:

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 的新方法?

提前谢谢!

4

1 回答 1

5

HybridHttpOrThreadLocalScoped已被移动到一个单独的 nuget 包中,名为Structuremap.Web.

它可以通过Install-Package structuremap.web在 Nuget 包控制台中运行来安装。 有关更多信息,请参阅此帖子

于 2014-12-22T21:48:02.323 回答