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
User197322208 posted
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.
Marked as answer byAnonymousThursday, October 7, 2021 12:00 AM
User197322208 posted
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.
Marked as answer byAnonymousThursday, October 7, 2021 12:00 AM
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