How to call HybridHttpOrThreadLocalScoped in StructureMap 3
I'm trying to go from Structuremap 2.6.4.1 to 3.1.4.143, but I can't figure out how to handle HybridHttpOrThreadLocalScoped. None of the SO Q / A I can find seem to work for me ...
I have the following code:
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 );
} );
which gives me this error:
'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?)
Is there a new way to call HybridHttpOrThreadLocalScoped?
Thanh in advance!
+3
source to share
1 answer
HybridHttpOrThreadLocalScoped
has been ported to a separate nuget package called Structuremap.Web
.
It can be installed by running Install-Package structuremap.web
Nuget Package Console in the console.
See this post for details .
+4
source to share