How to get same instance within a page request using structure map in asp.net?
I want to get sam开发者_JAVA百科e instance within a page request/ Can I use HybridHttpOrThreadLocalScoped() method for this? Can anyone help me with this?
You can use the HybridHttpOrThreadLocalScoped
, but using the HttpContextLifecycle
would be a more intuitive:
container.Configure(r => r
.For<IRepository>()
.Use<SqlRepository>()
.LifecycleIs(new HttpContextLifecycle());
精彩评论