Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Execute other functions -- lifecycle

$
0
0
Looking at the history of the mentioned files, they haven't changes for two and three years so i wouldn't worry too much about that :)

I would prob. look at HttpContext.Current.Items instead of Session if you only need to have shared objects for the lifecycle of a single request. Maybe a static class with properties like
public static class RequestContext
{
   public static RequestContext Current 
   { 
      get { return HttpContext.Current.Items["RequestContext"]; } 
      set { HttpContext.Current.Items["RequestContext"] = value; } 
   }

   public static object DbReader { get; set; }
   public static object Something { get; set; }
}
And at any point in your razor-code you can then do
@RequestContext.Current.Something

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>