Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
whats the role of singleton pattern in web application?

10 requests from different users for log in how it will be used?

instance will 10=1 or 10=10?

if 10=1? how it will be handled?

if 10=10? how it will be? where the instance is get stored? in case of web.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Sep-14 0:22am    
Not clear at all. Does not seem to make any sense. Let me tell you: 10≠1, 1≠10. :-)
—SA
/\jmot 27-Sep-14 2:50am    
Not clear,Please be clear..

1 solution

Please see my comment to the question.

The only reasonable answer I can give is: singleton pattern may or may not be used. This pattern should not be used often. In most cases of the application, it should not be used at all. So, what's the role of it in a Web application? No role at all, if you don't use this pattern. If you use this pattern, that is the role you gave to it. :-)

No special recommendations, except perhaps one:
In an ASP.NET application, try not to add any singletons in addition to those which already present in ASP.NET technology (or application environment), such as HttpContext. Please see this useful discussion: http://stackoverflow.com/questions/2134511/asp-net-singleton[^].

See also: http://msdn.microsoft.com/en-us/library/system.web.httpcontext%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900