Exemplo n.º 1
0
        protected override void GenerateSqlCommand(SqlCommand sqlCommand)
        {
            UnlockInstanceCommand instancePersistenceCommand = (UnlockInstanceCommand)base.InstancePersistenceCommand;
            SqlParameter          parameter = new SqlParameter {
                ParameterName = "@instanceId",
                SqlDbType     = SqlDbType.UniqueIdentifier,
                Value         = instancePersistenceCommand.InstanceId
            };

            sqlCommand.Parameters.Add(parameter);
            SqlParameter parameter2 = new SqlParameter {
                ParameterName = "@surrogateLockOwnerId",
                SqlDbType     = SqlDbType.BigInt,
                Value         = instancePersistenceCommand.SurrogateOwnerId
            };

            sqlCommand.Parameters.Add(parameter2);
            SqlParameter parameter3 = new SqlParameter {
                ParameterName = "@handleInstanceVersion",
                SqlDbType     = SqlDbType.BigInt,
                Value         = instancePersistenceCommand.InstanceVersion
            };

            sqlCommand.Parameters.Add(parameter3);
        }
Exemplo n.º 2
0
        internal void GenerateUnlockCommand(InstanceLockTracking instanceLockTracking)
        {
            UnlockInstanceCommand command = new UnlockInstanceCommand {
                SurrogateOwnerId = this.storeLock.SurrogateLockOwnerId,
                InstanceId       = instanceLockTracking.InstanceId,
                InstanceVersion  = instanceLockTracking.InstanceVersion
            };

            using (new TransactionScope(TransactionScopeOption.Suppress))
            {
                this.BeginTryCommandInternal(null, command, TimeSpan.MaxValue, this.unlockInstanceCallback, command);
            }
        }
Exemplo n.º 3
0
        protected override void GenerateSqlCommand(SqlCommand sqlCommand)
        {
            UnlockInstanceCommand unlockCommand = (UnlockInstanceCommand)(base.InstancePersistenceCommand);

            sqlCommand.Parameters.Add(new SqlParameter {
                ParameterName = "@instanceId", SqlDbType = SqlDbType.UniqueIdentifier, Value = unlockCommand.InstanceId
            });
            sqlCommand.Parameters.Add(new SqlParameter {
                ParameterName = "@surrogateLockOwnerId", SqlDbType = SqlDbType.BigInt, Value = unlockCommand.SurrogateOwnerId
            });
            sqlCommand.Parameters.Add(new SqlParameter {
                ParameterName = "@handleInstanceVersion", SqlDbType = SqlDbType.BigInt, Value = unlockCommand.InstanceVersion
            });
        }
Exemplo n.º 4
0
        private void ScheduledUnlockInstance(object state)
        {
            UnlockInstanceState   state2 = (UnlockInstanceState)state;
            UnlockInstanceCommand unlockInstanceCommand = state2.UnlockInstanceCommand;

            try
            {
                this.BeginTryCommandInternal(null, unlockInstanceCommand, TimeSpan.MaxValue, this.unlockInstanceCallback, unlockInstanceCommand);
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                if (TD.UnlockInstanceExceptionIsEnabled())
                {
                    TD.UnlockInstanceException(exception.Message);
                }
                state2.BackoffTimeoutHelper.WaitAndBackoff(this.scheduledUnlockInstance, state2);
            }
        }
Exemplo n.º 5
0
        void ScheduledUnlockInstance(object state)
        {
            UnlockInstanceState   unlockInstanceState = (UnlockInstanceState)state;
            UnlockInstanceCommand command             = unlockInstanceState.UnlockInstanceCommand;

            try
            {
                this.BeginTryCommandInternal(null, command, TimeSpan.MaxValue, unlockInstanceCallback, command);
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                if (TD.UnlockInstanceExceptionIsEnabled())
                {
                    TD.UnlockInstanceException(e.Message);
                }
                // Keep on going - if problems are severe the host will be faulted and we'll give up then.
                unlockInstanceState.BackoffTimeoutHelper.WaitAndBackoff(this.scheduledUnlockInstance, unlockInstanceState);
            }
        }
 internal void GenerateUnlockCommand(InstanceLockTracking instanceLockTracking)
 {
     UnlockInstanceCommand command = new UnlockInstanceCommand {
         SurrogateOwnerId = this.storeLock.SurrogateLockOwnerId,
         InstanceId = instanceLockTracking.InstanceId,
         InstanceVersion = instanceLockTracking.InstanceVersion
     };
     using (new TransactionScope(TransactionScopeOption.Suppress))
     {
         this.BeginTryCommandInternal(null, command, TimeSpan.MaxValue, this.unlockInstanceCallback, command);
     }
 }