Castle.Windsor lifestyle depending on context?

后端 未结 5 969
孤街浪徒
孤街浪徒 2020-12-29 04:44

I have a web application where many components are registered using .LifestylePerWebRequest(), now I\'ve decided to implement Quartz.NET, a .NE

5条回答
  •  盖世英雄少女心
    2020-12-29 05:37

    I don't know whats happening behind the scenes in .LifestylePerWebRequest(); but this is what I do for "Context per request" scenarios:

    Check HttpContext for session and if exists pull the context from .Items. If it doesn't exist pull your context from System.Threading.Thread.CurrentContext.

    Hope this helps.

提交回复
热议问题