Applkications, appdomains and singletons

  • Thread starter Thread starter mortb
  • Start date Start date
M

mortb

Hi,

If I want to implement a singleton using a class that has a static variable
containing the singleton object, can I guarantee that it will be a singleton
to my entire webapplication on a single webserver or may the webapplication
be loaded into several appdomains?

cheers,
mortb
 
Hello mortb,

See this http://www.codeproject.com/dotnet/remotingsingleton.asp

Btw, You can keep your singleton in Cache with CacheItemPriority.NotRemovable,
but you need to consider using some ways for the reliable cache in webfarms,
to have the single instance among all nodes

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

m> Hi,
m>
m> If I want to implement a singleton using a class that has a static
m> variable containing the singleton object, can I guarantee that it
m> will be a singleton to my entire webapplication on a single webserver
m> or may the webapplication be loaded into several appdomains?
m>
m> cheers,
m> mortb
 
Back
Top