PerWebRequest LifetimeManager and Beyond (Asp.net Mvc)
Posted
by Soe Moe
on Stack Overflow
See other posts from Stack Overflow
or by Soe Moe
Published on 2009-09-13T13:41:28Z
Indexed on
2010/03/19
1:31 UTC
Read the original article
Hit count: 747
asp.net-mvc
|unity
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.
© Stack Overflow or respective owner