are stationary category instances unparalleled ask server asp.net?
on an asp.net website, stationary classes unparalleled any web request, instantiated whenever indispensable gced whenever gc decides likely them?
the reason i ask since i've combined stationary classes before c# function opposite i have expected. i have approaching stationary classes unparalleled any request, nonetheless doesn't seem case.
if unparalleled any request, there proceed grant be?
update:
the answer driis gave me accurately i needed. i already controlling essay class, however controlling stationary instance therefore being common between requests even users opposite box bad thing. controlling httpcontext.current.items solves problem perfectly. anyone stumbles on doubt future, here implementation, simplified precipitated easy know pattern:
using system.collections;
using system.web;
public category globallyaccessibleclass
{
private globallyaccessibleclass() { }
open stationary globallyaccessibleclass instance
{
get
{
idictionary equipment = httpcontext.current.items;
if(!items.contains("theinstance"))
{
items["theinstance"] = new globallyaccessibleclass();
}
relapse items["theinstance"] globallyaccessibleclass;
}
}
}
Comments
Post a Comment