Singleton object for database class - but for multiple databases -
Singleton object for database class - but for multiple databases - background: writing c# class windows application deed customized sql server class includes custom error checking. , class allow general sql functions: executing queries, connecting database, closing connections, etc. my scenario this: have 2 separate databases need connect @ same time. want implement singleton pattern 1 connection can established each database (so total of 2 connections open @ once, 1 each database). want prevent sec connection either database beingness established. i thought flyweight pattern, don't think apply in case , if can singleton pattern work somehow improve solution... can not utilize singleton , have 2 database objects, or can create "open" flag in class checked when new connection requested see if existing connection open, , handle based on that... ideas / how can this? you can utilize mill pattern this. http://www.tutorialspoint.com/design_patter...