What is the equivalent of HybridHttpOrThreadLocalScoped in structure map 3?

天涯浪子 提交于 2020-01-02 00:54:10

问题


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?


回答1:


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.




回答2:


It is there, says here http://jeremydmiller.com/2014/03/31/structuremap-3-0-is-live/ that is now a Structuremap.Web nuget to add to your project for it to work.



来源:https://stackoverflow.com/questions/23040851/what-is-the-equivalent-of-hybridhttporthreadlocalscoped-in-structure-map-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!