PerWebRequest LifetimeManager and Beyond (Asp.net Mvc)
- by Soe Moe
Hi,
Currently, I created my custom PerWebRequestLifetimeManager using HttpContext.Current.Items as backing store. I used that lifetime manager for Linq2Sql DataContext.
Eveything is working fine until I need to use Cache for storing data (for 5 min). After 5 min, I need to retrieve data from DB and put it into the Cache. To do so, I need to use Linq2Sql DataContext for retrieving data. But during that time, HttpContext.Current is null because which was happened when cache is expired; not in Web Request.
So, what kind of LifetimeManager should I use for this scenario?
Thanks in advance.