private static void Main() { var poolObject = DbPoolConnection.GetInstance(5); poolObject.GetDatabaseConnection(); Console.ReadLine(); }
// retrieve instance of DbPoolConnection public static DbPoolConnection getInstance(int key) { lock (instances) { DbPoolConnection instance = null; if (!instances.ContainsKey(key)) { instance = new DbPoolConnection(); instances.Add(key, instance); } else { instance = instances[key]; } return(instance); } }