/// <summary>
        /// (OK)
        /// </summary>
        /// <returns> </returns>
        private bool TryGetDictionaryDbConnection(bool open, out IDbConnection dbConnection)
        {
            IDTSRuntimeConnection100 dtsRuntimeConnection100;
            IDTSConnectionManagerDatabaseParameters100 dtsConnectionManagerDatabaseParameters100;
            ConnectionManager connectionManager;

            dbConnection            = null;
            dtsRuntimeConnection100 = this.ComponentMetaData.RuntimeConnectionCollection[Constants.COMPONENT_RUNTIMECONNECTION_NAME_DICTIONARY];

            if ((object)dtsRuntimeConnection100.ConnectionManager != null)
            {
                connectionManager = DtsConvert.GetWrapper(dtsRuntimeConnection100.ConnectionManager);

                if ((object)(dtsConnectionManagerDatabaseParameters100 = connectionManager.InnerObject as IDTSConnectionManagerDatabaseParameters100) == null)
                {
                    return(false);
                }

                if (open)
                {
                    dbConnection = (IDbConnection)dtsConnectionManagerDatabaseParameters100.GetConnectionForSchema();
                }
            }

            return(true);
        }
Beispiel #2
0
        public override void AcquireConnections(object transaction)
        {
            if (ComponentMetaData.RuntimeConnectionCollection.Count <= 0)
            {
                return;
            }
            if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager == null)
            {
                return;
            }
            var cm = DtsConvert.GetWrapper(ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);

            if (cm.InnerObject != null)
            {
                var bimlCatalog = cm.InnerObject as ConnectionManagerAdoNet;

                if (bimlCatalog == null)
                {
                    throw new Exception("The ConnectionManager " + cm.Name + " is not an ADO.NET connection.");
                }

                _connection = bimlCatalog.AcquireConnection(transaction) as SqlConnection;
            }
            if (_connection == null || _connection.State == ConnectionState.Open)
            {
                return;
            }
            _connection.Open();
        }
        public override void AcquireConnections(object transaction)
        {
            if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
            {
                ConnectionManager connectionManager = DtsConvert.GetWrapper(
                    ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);

                this.rabbitMqConnectionManager = connectionManager.InnerObject as RabbitMQConnectionManager.RabbitMQConnectionManager;

                if (this.rabbitMqConnectionManager == null)
                {
                    throw new Exception("Couldn't get the RabbitMQ connection manager, ");
                }

                this.queueName = ComponentMetaData.CustomPropertyCollection["QueueName"].Value;

                rabbitConnection = this.rabbitMqConnectionManager.AcquireConnection(transaction) as IConnection;
            }
        }