Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / March 2005

Tip: Looking for answers? Try searching our database.

singleton scope

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 23 Mar 2005 09:27 GMT
A singleton in a web application seems to have scope through the app domain.
That is, different instances of a web site can access the same value.

Should I use singleton's in a web application?

I was thinking of using one to encapsulate session[] objects but this isn't
possible if it is shared.

How would this work on a web farm?

Any ideas?
Jason
Paul Glavich [MVP ASP.NET] - 26 Mar 2005 06:39 GMT
A singleton is merely a pattern or technique and is not necessarily tied to
an appDomain (although typically is). It really depends on what you are
trying to achieve eg. you may create a singleton for the entire system, or
only for that process, or only for that appDomain, or even within a
particular context

> That is, different instances of a web site can access the same value.
Can you explain this further. Do you mean different instances of different
web apps on the same machine?

Singletons are fine to use in web apps, provided they suit your specific
problem.

Typically, in a web farm scenario, one instance of the singleton object
exists in each appDomain on each server in the farm. Again, this is
generalising but I think it answers your question.
Signature


- Paul Glavich
ASP.NET MVP
ASPInsider (www.aspinsiders.com)

> A singleton in a web application seems to have scope through the app domain.
> That is, different instances of a web site can access the same value.
[quoted text clipped - 8 lines]
> Any ideas?
> Jason

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.