开发者

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());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜