/// <summary>
        /// Start the asynchronous query request operation.
        /// </summary>
        /// <param name="edmBase">The base generic data access layer.</param>
        /// <param name="callback">The asynchronous call back method.</param>
        /// <param name="state">The state object value.</param>
        /// <param name="linqEntityItems">The linq entities to insert.</param>
        public AsyncInsertCollection(IInsertEdmGenericBase <TDataContext, TLinqEntity> edmBase,
                                     AsyncCallback callback, object state, TLinqEntity[] linqEntityItems)
            : base(callback, state)
        {
            _linqEntityItems = linqEntityItems;
            _edmBase         = edmBase;

            ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncInsertThread1));
            Thread.Sleep(20);
        }
Beispiel #2
0
        // Dispose(bool disposing) executes in two distinct scenarios.
        // If disposing equals true, the method has been called directly
        // or indirectly by a user's code. Managed and unmanaged resources
        // can be disposed.
        // If disposing equals false, the method has been called by the
        // runtime from inside the finalizer and you should not reference
        // other objects. Only unmanaged resources can be disposed.
        private void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!this.disposed)
            {
                // If disposing equals true, dispose all managed
                // and unmanaged resources.
                if (disposing)
                {
                    // Dispose managed resources.
                    if (this._insertInstance != null)
                    {
                        ((IDisposable)_insertInstance).Dispose();
                    }

                    if (this._deleteInstance != null)
                    {
                        ((IDisposable)_deleteInstance).Dispose();
                    }

                    if (this._updateInstance != null)
                    {
                        ((IDisposable)_updateInstance).Dispose();
                    }

                    if (this._selectInstance != null)
                    {
                        ((IDisposable)_selectInstance).Dispose();
                    }
                }

                // Call the appropriate methods to clean up
                // unmanaged resources here.
                this._insertInstance = null;
                this._deleteInstance = null;
                this._updateInstance = null;
                this._selectInstance = null;

                // Note disposing has been done.
                disposed = true;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="configurationDatabaseConnection">The connection string or configuration key.</param>
        /// <param name="insertInstance">The insert instance; can be null if not in use.</param>
        /// <param name="deleteInstance">The delete instance; can be null if not in use.</param>
        /// <param name="updateInstance">The update instance; can be null if not in use.</param>
        /// <param name="selectInstance">The select instance; can be null if not in use.</param>
        public EdmTransactions(
            string configurationDatabaseConnection,
            IInsertEdmGenericBase <TDataContext, TLinqEntity> insertInstance,
            IDeleteEdmGenericBase <TDataContext, TLinqEntity> deleteInstance,
            IUpdateEdmGenericBase <TDataContext, TLinqEntity> updateInstance,
            ISelectEdmGenericBase <TDataContext, TLinqEntity> selectInstance)
        {
            // Check to see if the critical parameters
            // have been set, throw exception on each.
            if (String.IsNullOrEmpty(configurationDatabaseConnection))
            {
                throw new ArgumentNullException("configurationDatabaseConnection");
            }

            _configurationDatabaseConnection = configurationDatabaseConnection;
            _insertInstance = insertInstance;
            _deleteInstance = deleteInstance;
            _updateInstance = updateInstance;
            _selectInstance = selectInstance;
        }
Beispiel #4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="configurationDatabaseConnection">The connection string or configuration key.</param>
        /// <param name="connectionType">The database connection type.</param>
        /// <param name="connectionDataType">The database connection query type.</param>
        /// <param name="dataAccessProvider">The data access provider.</param>
        public EdmTransactions(
            string configurationDatabaseConnection,
            Nequeo.Data.DataType.ConnectionContext.ConnectionType connectionType,
            Nequeo.Data.DataType.ConnectionContext.ConnectionDataType connectionDataType,
            IDataAccess dataAccessProvider)
        {
            // Check to see if the critical parameters
            // have been set, throw exception on each.
            if (String.IsNullOrEmpty(configurationDatabaseConnection))
            {
                throw new ArgumentNullException("configurationDatabaseConnection");
            }

            _configurationDatabaseConnection = configurationDatabaseConnection;
            // Create an instance of each type.
            _insertInstance = new InsertEdmGenericBase <TDataContext, TLinqEntity>
                                  (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider);
            _deleteInstance = new DeleteEdmGenericBase <TDataContext, TLinqEntity>
                                  (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider);
            _updateInstance = new UpdateEdmGenericBase <TDataContext, TLinqEntity>
                                  (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider);
            _selectInstance = new SelectEdmGenericBase <TDataContext, TLinqEntity>
                                  (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider);
        }