/// <summary> /// Start the asynchronous query request operation. /// </summary> /// <param name="linqDataBase">The base generic data access layer.</param> /// <param name="callback">The asynchronous call back method.</param> /// <param name="state">The state object value.</param> public AsyncSelectLinqToSqlEntities(ISelectLinqToSqlGenericBase <TDataContext, TLinqEntity> linqDataBase, AsyncCallback callback, object state) : base(callback, state) { _linqDataBase = linqDataBase; ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncSelectThread1)); Thread.Sleep(20); }
/// <summary> /// Start the asynchronous query request operation. /// </summary> /// <param name="linqDataBase">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="keyValue">The value to search on.</param> public AsyncSelectIQueryableItems(ISelectLinqToSqlGenericBase <TDataContext, TLinqEntity> linqDataBase, AsyncCallback callback, object state, object keyValue) : base(callback, state) { _keyValue = keyValue; _linqDataBase = linqDataBase; ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncSelectThread2)); Thread.Sleep(20); }
/// <summary> /// Start the asynchronous query request operation. /// </summary> /// <param name="linqDataBase">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="predicate">The predicate string to search.</param> /// <param name="values">The values associated with the predicate string.</param> public AsyncSelectIQueryableItems(ISelectLinqToSqlGenericBase <TDataContext, TLinqEntity> linqDataBase, AsyncCallback callback, object state, string predicate, params object[] values) : base(callback, state) { _values = values; _predicate = predicate; _linqDataBase = linqDataBase; ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncSelectThread3)); Thread.Sleep(20); }
// 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; } }
/// <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 LinqToSqlTransactions( string configurationDatabaseConnection, IInsertLinqToSqlGenericBase <TDataContext, TLinqEntity> insertInstance, IDeleteLinqToSqlGenericBase <TDataContext, TLinqEntity> deleteInstance, IUpdateLinqToSqlGenericBase <TDataContext, TLinqEntity> updateInstance, ISelectLinqToSqlGenericBase <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; }
/// <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 LinqToSqlTransactions( 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 InsertLinqToSqlGenericBase <TDataContext, TLinqEntity> (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider); _deleteInstance = new DeleteLinqToSqlGenericBase <TDataContext, TLinqEntity> (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider); _updateInstance = new UpdateLinqToSqlGenericBase <TDataContext, TLinqEntity> (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider); _selectInstance = new SelectLinqToSqlGenericBase <TDataContext, TLinqEntity> (typeof(TLinqEntity).Name, connectionType, connectionDataType, dataAccessProvider); }