示例#1
0
 /// <summary>
 /// Asynchronous connection. This method or <see cref="Connect"/> must be called prior to utilizing the ServerConnection.
 /// </summary>
 /// <param name="callback">The method to invoke to handle the ConnectAsyncCompleted event when it is invoked</param>
 public void ConnectAsyncDelegate(Action <ConnectionResult, string> callback)
 {
     ConnectAsyncCompleted += callback;// new ConnectAsyncCompletedEvent(callback);
     _mongoServer           = null;
     _serverConnectionResetEvent.Reset();
     CreateMongoServerAsyncDelegatePointer.BeginInvoke(AsyncConnectCallback, null);
 }
        public void ConnectAsyncDelegate(Action <ConnectionResult, string> callback)
        {
            ConnectAsyncCompleted += callback;// new ConnectAsyncCompletedEvent(callback);

            Db = null;
            _serverConnectionResetEvent.Reset();
            _databaseConnectionResetEvent.Reset();

            // invoke GetMongoDatabase() asynchronously via delegate BeginInvoke
            ConnectAsyncDelegatePointer.BeginInvoke(AsyncConnectCallback, null);
        }