void StartOperation()
        {
            Guid      instanceId       = (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.InstanceView.InstanceId : Guid.Empty;
            Exception delayedException = null;

            try
            {
                this.sqlCommand = new SqlCommand();
                this.GenerateSqlCommand(this.sqlCommand);
                this.sqlCommand.CommandText = this.GetSqlCommandText();
                this.sqlCommand.CommandType = this.GetSqlCommandType();

                StoreUtilities.TraceSqlCommand(this.sqlCommand, true);
                SqlCommandAsyncResult sqlCommandResult = new SqlCommandAsyncResult(this.sqlCommand, this.ConnectionString,
                                                                                   (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.EventTraceActivity : null,
                                                                                   this.DependentTransaction, this.TimeoutHelper.RemainingTime(), 0, this.maximumRetries, PrepareAsyncCompletion(onSqlCommandAsyncResultCallback), this);
                sqlCommandResult.StartCommand();

                if (!SyncContinue(sqlCommandResult))
                {
                    return;
                }
            }
            catch (InstancePersistenceException instancePersistenceException)
            {
                delayedException = instancePersistenceException;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }

                delayedException = new InstancePersistenceCommandException(this.InstancePersistenceCommand.Name, instanceId, exception);
            }

            if (delayedException != null)
            {
                if (this.sqlCommand.Connection != null)
                {
                    this.sqlCommand.Connection.Close();
                }

                this.sqlCommand.Dispose();
                this.TraceException(delayedException);
            }

            this.Complete(false, delayedException);
        }
        private void StartOperation()
        {
            Guid      instanceId = (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.InstanceView.InstanceId : Guid.Empty;
            Exception exception  = null;

            try
            {
                this.sqlCommand = new SqlCommand();
                this.GenerateSqlCommand(this.sqlCommand);
                this.sqlCommand.CommandText = this.GetSqlCommandText();
                this.sqlCommand.CommandType = this.GetSqlCommandType();
                StoreUtilities.TraceSqlCommand(this.sqlCommand, true);
                SqlCommandAsyncResult result = new SqlCommandAsyncResult(this.sqlCommand, this.ConnectionString, this.DependentTransaction, this.TimeoutHelper.RemainingTime(), 0, this.Store.MaxConnectionRetries, base.PrepareAsyncCompletion(onSqlCommandAsyncResultCallback), this);
                result.StartCommand();
                if (!base.SyncContinue(result))
                {
                    return;
                }
            }
            catch (InstancePersistenceException exception2)
            {
                exception = exception2;
            }
            catch (Exception exception3)
            {
                if (Fx.IsFatal(exception3))
                {
                    throw;
                }
                exception = new InstancePersistenceCommandException(this.InstancePersistenceCommand.Name, instanceId, exception3);
            }
            if (exception != null)
            {
                if (this.sqlCommand.Connection != null)
                {
                    this.sqlCommand.Connection.Close();
                }
                this.sqlCommand.Dispose();
                this.TraceException(exception);
            }
            base.Complete(false, exception);
        }
        void StartOperation()
        {
            Guid instanceId = (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.InstanceView.InstanceId : Guid.Empty;
            Exception delayedException = null;

            try
            {
                this.sqlCommand = new SqlCommand();
                this.GenerateSqlCommand(this.sqlCommand);
                this.sqlCommand.CommandText = this.GetSqlCommandText();
                this.sqlCommand.CommandType = this.GetSqlCommandType();

                StoreUtilities.TraceSqlCommand(this.sqlCommand, true);
                SqlCommandAsyncResult sqlCommandResult = new SqlCommandAsyncResult(this.sqlCommand, this.ConnectionString,
                    (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.EventTraceActivity : null,
                    this.DependentTransaction, this.TimeoutHelper.RemainingTime(), 0, this.maximumRetries, PrepareAsyncCompletion(onSqlCommandAsyncResultCallback), this);
                sqlCommandResult.StartCommand();

                if (!SyncContinue(sqlCommandResult))
                {
                    return;
                }
            }
            catch (InstancePersistenceException instancePersistenceException)
            {
                delayedException = instancePersistenceException;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }

                delayedException = new InstancePersistenceCommandException(this.InstancePersistenceCommand.Name, instanceId, exception);
            }

            if (delayedException != null)
            {
                if (this.sqlCommand.Connection != null)
                {
                    this.sqlCommand.Connection.Close();
                }

                this.sqlCommand.Dispose();
                this.TraceException(delayedException);
            }

            this.Complete(false, delayedException);
        }
 private void StartOperation()
 {
     Guid instanceId = (this.InstancePersistenceContext != null) ? this.InstancePersistenceContext.InstanceView.InstanceId : Guid.Empty;
     Exception exception = null;
     try
     {
         this.sqlCommand = new SqlCommand();
         this.GenerateSqlCommand(this.sqlCommand);
         this.sqlCommand.CommandText = this.GetSqlCommandText();
         this.sqlCommand.CommandType = this.GetSqlCommandType();
         StoreUtilities.TraceSqlCommand(this.sqlCommand, true);
         SqlCommandAsyncResult result = new SqlCommandAsyncResult(this.sqlCommand, this.ConnectionString, this.DependentTransaction, this.TimeoutHelper.RemainingTime(), 0, this.Store.MaxConnectionRetries, base.PrepareAsyncCompletion(onSqlCommandAsyncResultCallback), this);
         result.StartCommand();
         if (!base.SyncContinue(result))
         {
             return;
         }
     }
     catch (InstancePersistenceException exception2)
     {
         exception = exception2;
     }
     catch (Exception exception3)
     {
         if (Fx.IsFatal(exception3))
         {
             throw;
         }
         exception = new InstancePersistenceCommandException(this.InstancePersistenceCommand.Name, instanceId, exception3);
     }
     if (exception != null)
     {
         if (this.sqlCommand.Connection != null)
         {
             this.sqlCommand.Connection.Close();
         }
         this.sqlCommand.Dispose();
         this.TraceException(exception);
     }
     base.Complete(false, exception);
 }