Could you please let me know one practical usage of singleton pattern in asp.net application development. I know the concept but not able to decide on where I should use it. I am looking for some basic examples
for a unit of work, the database connection should be a singleton let's say you want to load all "products" from a table and all "news" to display in the same page. the classes that have to load "products" and "news" requires a connection. If you make the connection
a singleton, then you will not open 2 connections.
Thanks for your reply. But connection to the database is a general example and I have a SQL helper class already for it. Can you please give another example? A high level description is enough. Thanks, Zamsheer
Member
3 Points
16 Posts
SingleTon Practical usage
Dec 22, 2010 02:21 AM|Zamsheer|LINK
Hi all,
Could you please let me know one practical usage of singleton pattern in asp.net application development. I know the concept but not able to decide on where I should use it. I am looking for some basic examples
Regards,
Zamsheer
All-Star
120166 Points
27994 Posts
Moderator
MVP
Re: SingleTon Practical usage
Dec 22, 2010 03:50 AM|ignatandrei|LINK
Member
3 Points
16 Posts
Re: SingleTon Practical usage
Feb 03, 2011 01:39 AM|Zamsheer|LINK
Thanks for your reply. But connection to the database is a general example and I have a SQL helper class already for it. Can you please give another example? A high level description is enough. Thanks, Zamsheer
Contributor
6087 Points
1704 Posts
Re: SingleTon Practical usage
Feb 03, 2011 05:21 AM|sandy060583|LINK
Hi Zamsheer,
Here is the example you are looking for :
http://aspalliance.com/810
Hope this will help !!!
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)