Ejemplo n.º 1
0
        public static DBDataSourceConnectionHandler GetSharedConnectionHandler(string DBServerName, string DataBaseName, string UserID, string userPassword, DataSourceProviderType DBProvider)
        {
            string cnnString = "";

            //crates the datasourder connection string
            cnnString = GetConnectionString(DBProvider, DBServerName, DataBaseName, UserID, userPassword);

            //verifies if there is a connection that matches the connection string

            DBDataSourceConnectionHandler handler = null;

            lock (_sharedConnectionsTable)
            {
                if (_sharedConnectionsTable.ContainsKey(cnnString))
                {
                    handler = (DataBaseLibrary.DBDataSourceConnectionHandler)(_sharedConnectionsTable[cnnString]);
                }
                else
                {
                    handler = new DBDataSourceConnectionHandler(DBServerName, DataBaseName, UserID, userPassword, DBProvider);
                    _sharedConnectionsTable.Add(cnnString, handler);
                }
            }


            return(handler);
        }
Ejemplo n.º 2
0
        public static DBDataSourceConnectionHandler GetDedicatedConnectionHandler(string DBServerName, string DataBaseName, string UserID, string userPassword, DataSourceProviderType DBProvider)
        {
            DBDataSourceConnectionHandler handler = new DBDataSourceConnectionHandler(DBServerName, DataBaseName, UserID, userPassword, DBProvider);

            return(handler);
        }