예제 #1
0
        private void LoadContainers(ConnectionManagerElement cme)
        {
            this.cmbContainerID.Items.Clear();

            ConnectionManagerMappingEventArgs args = new ConnectionManagerMappingEventArgs();

            args.ConnectionManagerElement = cme;
            ConnectionManager cm = this.GetSelectedConnectionManager(this, args);

            try
            {
                Microsoft.Samples.DataServices.Connectivity.Connection conn = cm.AcquireConnection(null) as Connection;

                if (conn != null)
                {
                    Microsoft.Samples.DataServices.Connectivity.Container[] conts = conn.GetContainers();

                    if (conts != null)
                    {
                        foreach (Microsoft.Samples.DataServices.Connectivity.Container cont in conts)
                        {
                            this.cmbContainerID.Items.Add(cont.Id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
                this.cmbContainerID.Items.Clear();
                this.btnNewContainer.Enabled = false;
            }
        }
예제 #2
0
 /// <summary>
 /// Releases the connection established in AcquireConnections
 /// </summary>
 public override void ReleaseConnections()
 {
     if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
     {
         ConnectionManager cm =
             Microsoft.SqlServer.Dts.Runtime.DtsConvert.ToConnectionManager(
                 ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);
         cm.ReleaseConnection(_con);
         _con = null;
     }
     else
     {
         _con = null;
     }
 }
예제 #3
0
        /// <summary>
        /// Called at design time and runtime. Establishes a connection using a ConnectionManager in the package.
        /// </summary>
        /// <param name="transaction">Not used.</param>
        public override void AcquireConnections(object transaction)
        {
            if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
            {
                ConnectionManager cm =
                    Microsoft.SqlServer.Dts.Runtime.DtsConvert.ToConnectionManager(
                    ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);

                _connection = (Connection)cm.AcquireConnection(null);
                if ((_connection == null) || (_connection.Test() != true))
                    ComponentMetaData.FireError(0, ComponentMetaData.Name, "Connection object got from connection manager is not valid", string.Empty, 0, out this._cancel);
            }
            else
            {
                _connection = null;
            }
        }
예제 #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_con != null)
                {
                    _con.Dispose();
                    _con = null;
                }

                if (_threadPool != null)
                {
                    _threadPool.Dispose();
                    _threadPool = null;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Called at design time and runtime. Establishes a connection using a ConnectionManager in the package.
        /// </summary>
        /// <param name="transaction">Not used.</param>
        public override void AcquireConnections(object transaction)
        {
            if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
            {
                ConnectionManager cm =
                    Microsoft.SqlServer.Dts.Runtime.DtsConvert.ToConnectionManager(
                        ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);

                _con = (SsdsConnection)cm.AcquireConnection(null);
                if ((_con == null) || (_con.Test() != true))
                {
                    ComponentMetaData.FireError(0, ComponentMetaData.Name, "Connection object got from connection manager is not valid", string.Empty, 0, out this._cancel);
                }
            }
            else
            {
                _con = null;
            }
        }
예제 #6
0
        static internal Container Create(Connection connection, SitkaClient.Entity sitkaContainer)
        {
            Container newContainer = new Container();
            newContainer.CopyFrom(sitkaContainer);
            newContainer.connection = connection;

            return newContainer;
        }
예제 #7
0
 /// <summary>
 /// Releases the connection established in AcquireConnections
 /// </summary>
 public override void ReleaseConnections()
 {
     if (ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager != null)
     {
         ConnectionManager cm =
             Microsoft.SqlServer.Dts.Runtime.DtsConvert.ToConnectionManager(
             ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager);
         cm.ReleaseConnection(_connection);
         _connection = null;
     }
     else
     {
         _connection = null;
     }
 }
예제 #8
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_con != null)
                {
                    _con.Dispose();
                    _con = null;
                }

                if (_threadPool != null)
                {
                    _threadPool.Dispose();
                    _threadPool = null;
                }
            }
        }