问题描述
使用structuremap 2.6.4.1,我的容器配置如下:
existingContainer.Configure(expression =>
{
expression.For< IDocumentSession>()
.HybridHttpOrThreadLocalScoped()
.Use(container =>
{
var store = container.GetInstance< IDocumentStore> ;();
return store.OpenSession();
});
}
HybridHttpOrThreadLocalScoped
在结构图3中不存在,所以我的问题是,结构图3中的等效配置是什么?
从StructureMap 3开始,与 HttpContext
相关的任何内容都存在于名为的单独Nuget包中。 StructureMap.Web
,可以。 p>
原因是Struc tureMap 3现在符合PLC(Portalble类库)的要求,因此将与Web相关的生命周期分成自己的程序包是有意义的。
With structuremap 2.6.4.1 my container is configured like this:
existingContainer.Configure(expression =>
{
expression.For<IDocumentSession>()
.HybridHttpOrThreadLocalScoped()
.Use(container =>
{
var store = container.GetInstance<IDocumentStore>();
return store.OpenSession();
});
}
HybridHttpOrThreadLocalScoped
does not exist in structure map 3 so my question is, what is the equivalent configuration in structuremap 3?
As of StructureMap 3, anything HttpContext
related lives within a separate Nuget package called StructureMap.Web
which can be found here.
The reason for this is StructureMap 3 is now PLC (Portalble Class Library) compliant, so splitting web-related lifecycles into its own package makes sense.
这篇关于结构图3中的HybridHttpOrThreadLocalScoped等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!