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); }
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); } }
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 }); }
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); } }
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); } }