Beispiel #1
0
 /// <summary>
 /// Reopens the connection to the database server asynchronously.
 /// </summary>
 /// <param name="callback">The callback method.</param>
 /// <param name="userState">The user state.</param>
 /// <returns>The asynchronous result.</returns>
 public abstract IAsyncResult Reopen(DbServerCallback callback, object userState = null);
 /// <summary>
 /// Reopens the connection to the database server asynchronously.
 /// </summary>
 /// <param name="callback">The callback method.</param>
 /// <param name="userState">The user state.</param>
 /// <returns>The asynchronous result.</returns>
 public override IAsyncResult Reopen(DbServerCallback callback, object userState = null)
 {
     // Create a new asynchrounous state for this operation.
     DbServerAsyncState asyncState = new DbServerAsyncState(this, userState);
     // Begin open the connection asynchronously on the thread pool.
     ThreadPool.QueueUserWorkItem((object state) =>
         {
             // Execute asynchronously on the thread pool.
             try
             {
                 // Reopen the connection.
                 this.Reopen();
             }
             catch (Exception exception)
             {
                 // If an exception occurs, set the callback exception.
                 asyncState.Exception = new DbException("Reopening the connection to the database server \'{0}\' failed.".FormatWith(this.Name), exception);
             }
             // Complete the asynchronous operation.
             asyncState.Complete();
             // Call the callback method with the given state.
             if (callback != null) callback(asyncState);
         });
     return asyncState;
 }
Beispiel #3
0
 /// <summary>
 /// Changes the current password of the database server asynchronously.
 /// </summary>
 /// <param name="newPassword">The new password.</param>
 /// <param name="callback">The callback method.</param>
 /// <param name="userState">The user state.</param>
 /// <returns>The asynchronous result.</returns>
 public abstract IAsyncResult ChangePassword(SecureString newPassword, DbServerCallback callback, object userState = null);