protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { reader.NextResult(); List <IDictionary <XName, object> > parameters = new List <IDictionary <XName, object> >(); if (reader.Read()) { do { IDictionary <XName, object> item = new Dictionary <XName, object>(); item.Add(WorkflowServiceNamespace.SiteName, reader.GetString(0)); item.Add(WorkflowServiceNamespace.RelativeApplicationPath, reader.GetString(1)); item.Add(WorkflowServiceNamespace.RelativeServicePath, reader.GetString(2)); parameters.Add(item); }while (reader.Read()); } else { base.Store.UpdateEventStatus(false, InstancePersistenceEvent <HasActivatableWorkflowEvent> .Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false); } base.InstancePersistenceContext.QueriedInstanceStore(new ActivatableWorkflowsQueryResult(parameters)); } return(nextResultSet); }
private static void Finally(AsyncResult result, Exception currentException) { SqlWorkflowInstanceStoreAsyncResult result2 = result as SqlWorkflowInstanceStoreAsyncResult; try { if (result2.DependentTransaction != null) { using (result2.DependentTransaction) { result2.DependentTransaction.Complete(); } } } catch (TransactionException) { if (currentException == null) { throw; } } finally { result2.OnCommandCompletion(); result2.ClearMembers(); StoreUtilities.TraceSqlCommand(result2.sqlCommand, false); } }
void ReadKeyData(SqlDataReader reader, Dictionary <Guid, IDictionary <XName, InstanceValue> > associatedInstanceKeys, Dictionary <Guid, IDictionary <XName, InstanceValue> > completedInstanceKeys) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { if (reader.IsDBNull(1)) { return; } do { Guid key = reader.GetGuid(1); bool isAssociated = reader.GetBoolean(2); InstanceEncodingOption encodingOption = (InstanceEncodingOption)reader.GetByte(3); Dictionary <Guid, IDictionary <XName, InstanceValue> > destination = isAssociated ? associatedInstanceKeys : completedInstanceKeys; if (!reader.IsDBNull(4)) { destination[key] = SerializationUtilities.DeserializeKeyMetadata((byte[])reader.GetValue(4), encodingOption); } else { destination[key] = new Dictionary <XName, InstanceValue>(); } }while (reader.Read()); } }
public static Exception GetNextResultSet(XName commandName, SqlDataReader reader) { do { if (reader.Read()) { do { if (reader.FieldCount == 0) { continue; } string columnName = reader.GetName(0); if (string.Compare("Result", columnName, StringComparison.Ordinal) == 0) { return(StoreUtilities.CheckResult(commandName, reader)); } }while (reader.Read()); } }while (reader.NextResult()); return(null); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { bool flag = !reader.IsDBNull(1); TimeSpan?taskIntervalOverride = null; bool flag2 = false; if (flag) { DateTime dateTime = reader.GetDateTime(1); DateTime time2 = reader.GetDateTime(2); if (dateTime <= time2) { flag2 = true; } else { taskIntervalOverride = new TimeSpan?(dateTime.Subtract(time2)); } } if (flag2) { base.Store.UpdateEventStatus(true, InstancePersistenceEvent <HasRunnableWorkflowEvent> .Value); return(nextResultSet); } base.Store.UpdateEventStatus(false, InstancePersistenceEvent <HasRunnableWorkflowEvent> .Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false, taskIntervalOverride); } return(nextResultSet); }
void ReadInstanceMetadataChanges(SqlDataReader reader, Dictionary <XName, InstanceValue> instanceMetadata) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { if (reader.IsDBNull(1)) { return; } } do { InstanceEncodingOption encodingOption = (InstanceEncodingOption)reader.GetByte(1); byte[] serializedMetadataChanges = (byte[])reader.GetValue(2); Dictionary <XName, InstanceValue> metadataChangeSet = SerializationUtilities.DeserializeMetadataPropertyBag(serializedMetadataChanges, encodingOption); foreach (KeyValuePair <XName, InstanceValue> metadataChange in metadataChangeSet) { XName xname = metadataChange.Key; InstanceValue propertyValue = metadataChange.Value; if (propertyValue.Value is DeletedMetadataValue) { instanceMetadata.Remove(xname); } else { instanceMetadata[xname] = propertyValue; } } }while (reader.Read()); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { SaveWorkflowCommand saveWorkflowCommand = base.InstancePersistenceCommand as SaveWorkflowCommand; InstanceLockTracking instanceLockTracking = (InstanceLockTracking)(base.InstancePersistenceContext.UserContext); if ((this.serviceDeploymentHash != Guid.Empty) && (this.serviceDeploymentId == 0)) { this.serviceDeploymentId = reader.GetInt64(1); PutServiceDeploymentId(); exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); } if (exception == null) { if (!base.InstancePersistenceContext.InstanceView.IsBoundToLock) { long instanceVersion = reader.GetInt64(1); instanceLockTracking.TrackStoreLock(base.InstancePersistenceContext.InstanceView.InstanceId, instanceVersion, this.DependentTransaction); base.InstancePersistenceContext.BindAcquiredLock(instanceVersion); } if (saveWorkflowCommand.InstanceData.Count > 0) { base.InstancePersistenceContext.PersistedInstance(saveWorkflowCommand.InstanceData); } SaveWorkflowAsyncResult.UpdateKeyData(base.InstancePersistenceContext, saveWorkflowCommand); foreach (KeyValuePair <XName, InstanceValue> property in saveWorkflowCommand.InstanceMetadataChanges) { base.InstancePersistenceContext.WroteInstanceMetadataValue(property.Key, property.Value); } if (saveWorkflowCommand.CompleteInstance) { base.InstancePersistenceContext.CompletedInstance(); } if (saveWorkflowCommand.UnlockInstance || saveWorkflowCommand.CompleteInstance) { instanceLockTracking.TrackStoreUnlock(this.DependentTransaction); base.InstancePersistenceContext.InstanceHandle.Free(); } } else if (exception is InstanceLockLostException) { base.InstancePersistenceContext.InstanceHandle.Free(); } } return(exception); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if ((nextResultSet == null) && (!reader.GetBoolean(1) || (base.ProcessSqlResult(reader) != null))) { base.Store.UpdateEventStatus(false, InstancePersistenceEvent <HasRunnableWorkflowEvent> .Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false); } return(nextResultSet); }
public static Exception CheckRemainingResultSetForErrors(XName commandName, SqlDataReader reader) { Exception returnException = null; do { returnException = StoreUtilities.GetNextResultSet(commandName, reader); }while (returnException == null && reader.NextResult()); return(returnException); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = null; exception = StoreUtilities.CheckRemainingResultSetForErrors(base.InstancePersistenceCommand.Name, reader); if (exception == null) { base.InstancePersistenceContext.InstanceHandle.Free(); base.StoreLock.MarkInstanceOwnerLost(this.surrogateLockOwnerId, true); } return(exception); }
public static Exception CheckResult(XName commandName, SqlDataReader reader) { Exception returnValue = null; CommandResult result = (CommandResult)reader.GetInt32(0); if (result != CommandResult.Success) { returnValue = StoreUtilities.GetError(commandName, result, reader); } return(returnValue); }
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); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { SaveWorkflowCommand instancePersistenceCommand = base.InstancePersistenceCommand as SaveWorkflowCommand; InstanceLockTracking userContext = (InstanceLockTracking)base.InstancePersistenceContext.UserContext; if ((this.serviceDeploymentHash != Guid.Empty) && (this.serviceDeploymentId == 0L)) { this.serviceDeploymentId = reader.GetInt64(1); this.PutServiceDeploymentId(); nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); } if (nextResultSet == null) { if (!base.InstancePersistenceContext.InstanceView.IsBoundToLock) { long instanceVersion = reader.GetInt64(1); userContext.TrackStoreLock(base.InstancePersistenceContext.InstanceView.InstanceId, instanceVersion, base.DependentTransaction); base.InstancePersistenceContext.BindAcquiredLock(instanceVersion); } if (instancePersistenceCommand.InstanceData.Count > 0) { base.InstancePersistenceContext.PersistedInstance(instancePersistenceCommand.InstanceData); } UpdateKeyData(base.InstancePersistenceContext, instancePersistenceCommand); foreach (KeyValuePair <XName, InstanceValue> pair in instancePersistenceCommand.InstanceMetadataChanges) { base.InstancePersistenceContext.WroteInstanceMetadataValue(pair.Key, pair.Value); } if (instancePersistenceCommand.CompleteInstance) { base.InstancePersistenceContext.CompletedInstance(); } if (instancePersistenceCommand.UnlockInstance || instancePersistenceCommand.CompleteInstance) { userContext.TrackStoreUnlock(base.DependentTransaction); base.InstancePersistenceContext.InstanceHandle.Free(); } return(nextResultSet); } if (nextResultSet is InstanceLockLostException) { base.InstancePersistenceContext.InstanceHandle.Free(); } } return(nextResultSet); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(this.InstancePersistenceCommand.Name, reader); if (exception == null) { bool runnableInstanceFound = reader.GetBoolean(1); if (!runnableInstanceFound || base.ProcessSqlResult(reader) != null) { base.Store.UpdateEventStatus(false, HasRunnableWorkflowEvent.Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false); } } return(exception); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { reader.NextResult(); if (reader.Read()) { base.Store.UpdateEventStatus(true, InstancePersistenceEvent <HasActivatableWorkflowEvent> .Value); return(nextResultSet); } base.Store.UpdateEventStatus(false, InstancePersistenceEvent <HasActivatableWorkflowEvent> .Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false); } return(nextResultSet); }
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); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { base.InstancePersistenceContext.BindInstanceOwner(this.lockOwnerId, this.lockOwnerId); long surrogateLockOwnerId = reader.GetInt64(1); if (this.fireActivatableInstancesEvent) { base.InstancePersistenceContext.BindEvent(InstancePersistenceEvent <HasActivatableWorkflowEvent> .Value); } else if (this.fireRunnableInstancesEvent) { base.InstancePersistenceContext.BindEvent(InstancePersistenceEvent <HasRunnableWorkflowEvent> .Value); } base.StoreLock.MarkInstanceOwnerCreated(this.lockOwnerId, surrogateLockOwnerId, base.InstancePersistenceContext.InstanceHandle, this.fireRunnableInstancesEvent, this.fireActivatableInstancesEvent); } return(nextResultSet); }
private void ReadKeyData(SqlDataReader reader, Dictionary <Guid, IDictionary <XName, InstanceValue> > associatedInstanceKeys, Dictionary <Guid, IDictionary <XName, InstanceValue> > completedInstanceKeys) { if ((StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader) == null) && !reader.IsDBNull(1)) { do { Guid guid = reader.GetGuid(1); bool boolean = reader.GetBoolean(2); InstanceEncodingOption @byte = (InstanceEncodingOption)reader.GetByte(3); Dictionary <Guid, IDictionary <XName, InstanceValue> > dictionary = boolean ? associatedInstanceKeys : completedInstanceKeys; if (!reader.IsDBNull(4)) { dictionary[guid] = SerializationUtilities.DeserializeKeyMetadata((byte[])reader.GetValue(4), @byte); } else { dictionary[guid] = new Dictionary <XName, InstanceValue>(); } }while (reader.Read()); } }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { bool signalEvent = false; reader.NextResult(); signalEvent = reader.Read(); //The result set contains activatable workflows if (signalEvent) { base.Store.UpdateEventStatus(true, HasActivatableWorkflowEvent.Value); } else { base.Store.UpdateEventStatus(false, HasActivatableWorkflowEvent.Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false); } } return(exception); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { bool instancesExist = !reader.IsDBNull(1); TimeSpan?timeTillNextPoll = null; bool instancesReadyToRun = false; if (instancesExist) { DateTime expirationTime = reader.GetDateTime(1); DateTime utcNow = reader.GetDateTime(2); if (expirationTime <= utcNow) { instancesReadyToRun = true; } else { timeTillNextPoll = expirationTime.Subtract(utcNow); } } if (instancesReadyToRun) { base.Store.UpdateEventStatus(true, HasRunnableWorkflowEvent.Value); } else { base.Store.UpdateEventStatus(false, HasRunnableWorkflowEvent.Value); base.StoreLock.InstanceDetectionTask.ResetTimer(false, timeTillNextPoll); } } return(exception); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(this.InstancePersistenceCommand.Name, reader); if (exception == null) { base.InstancePersistenceContext.BindInstanceOwner(this.lockOwnerId, this.lockOwnerId); long surrogateLockOwnerId = reader.GetInt64(1); // Activatable takes precendence over Runnable. (Activation owners cannot run instances.) if (this.fireActivatableInstancesEvent) { base.InstancePersistenceContext.BindEvent(HasActivatableWorkflowEvent.Value); } else if (this.fireRunnableInstancesEvent) { base.InstancePersistenceContext.BindEvent(HasRunnableWorkflowEvent.Value); } base.StoreLock.MarkInstanceOwnerCreated(this.lockOwnerId, surrogateLockOwnerId, base.InstancePersistenceContext.InstanceHandle, this.fireRunnableInstancesEvent, this.fireActivatableInstancesEvent); } return(exception); }
private void ReadInstanceMetadataChanges(SqlDataReader reader, Dictionary <XName, InstanceValue> instanceMetadata) { if ((StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader) != null) || !reader.IsDBNull(1)) { do { InstanceEncodingOption @byte = (InstanceEncodingOption)reader.GetByte(1); byte[] serializedMetadataProperties = (byte[])reader.GetValue(2); foreach (KeyValuePair <XName, InstanceValue> pair in SerializationUtilities.DeserializeMetadataPropertyBag(serializedMetadataProperties, @byte)) { XName key = pair.Key; InstanceValue value2 = pair.Value; if (value2.Value is DeletedMetadataValue) { instanceMetadata.Remove(key); } else { instanceMetadata[key] = value2; } } }while (reader.Read()); } }
protected override Exception ProcessSqlResult(SqlDataReader reader) { return(StoreUtilities.CheckRemainingResultSetForErrors(base.InstancePersistenceCommand.Name, reader)); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception exception = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (exception == null) { Guid instanceId = reader.GetGuid(1); long surrogateInstanceId = reader.GetInt64(2); byte[] primitiveProperties = reader.IsDBNull(3) ? null : (byte[])(reader.GetValue(3)); byte[] complexProperties = reader.IsDBNull(4) ? null : (byte[])(reader.GetValue(4)); byte[] metadataProperties = reader.IsDBNull(5) ? null : (byte[])(reader.GetValue(5)); InstanceEncodingOption dataEncodingOption = (InstanceEncodingOption)(reader.GetByte(6)); InstanceEncodingOption metadataEncodingOption = (InstanceEncodingOption)(reader.GetByte(7)); long version = reader.GetInt64(8); bool isInitialized = reader.GetBoolean(9); bool createdInstance = reader.GetBoolean(10); LoadWorkflowCommand loadWorkflowCommand = base.InstancePersistenceCommand as LoadWorkflowCommand; LoadWorkflowByInstanceKeyCommand loadByKeycommand = base.InstancePersistenceCommand as LoadWorkflowByInstanceKeyCommand; if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstance) { base.InstancePersistenceContext.BindInstance(instanceId); } if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstanceOwner) { base.InstancePersistenceContext.BindInstanceOwner(base.StoreLock.LockOwnerId, base.StoreLock.LockOwnerId); } if (!base.InstancePersistenceContext.InstanceView.IsBoundToLock) { InstanceLockTracking instanceLockTracking = (InstanceLockTracking)(base.InstancePersistenceContext.UserContext); instanceLockTracking.TrackStoreLock(instanceId, version, this.DependentTransaction); base.InstancePersistenceContext.BindAcquiredLock(version); } this.instanceData = SerializationUtilities.DeserializePropertyBag(primitiveProperties, complexProperties, dataEncodingOption); this.instanceMetadata = SerializationUtilities.DeserializeMetadataPropertyBag(metadataProperties, metadataEncodingOption); if (!createdInstance) { ReadInstanceMetadataChanges(reader, this.instanceMetadata); ReadKeyData(reader, this.associatedInstanceKeys, this.completedInstanceKeys); } else if (loadByKeycommand != null) { foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > keyEntry in loadByKeycommand.InstanceKeysToAssociate) { this.associatedInstanceKeys.Add(keyEntry.Key, keyEntry.Value); } if (!this.associatedInstanceKeys.ContainsKey(loadByKeycommand.LookupInstanceKey)) { base.InstancePersistenceContext.AssociatedInstanceKey(loadByKeycommand.LookupInstanceKey); this.associatedInstanceKeys.Add(loadByKeycommand.LookupInstanceKey, new Dictionary <XName, InstanceValue>()); } } if (loadByKeycommand != null) { foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > keyEntry in loadByKeycommand.InstanceKeysToAssociate) { base.InstancePersistenceContext.AssociatedInstanceKey(keyEntry.Key); if (keyEntry.Value != null) { foreach (KeyValuePair <XName, InstanceValue> property in keyEntry.Value) { base.InstancePersistenceContext.WroteInstanceKeyMetadataValue(keyEntry.Key, property.Key, property.Value); } } } } base.InstancePersistenceContext.LoadedInstance ( isInitialized ? InstanceState.Initialized : InstanceState.Uninitialized, this.instanceData, this.instanceMetadata, this.associatedInstanceKeys, this.completedInstanceKeys ); } else if (exception is InstanceLockLostException) { base.InstancePersistenceContext.InstanceHandle.Free(); } return(exception); }
void StartCommandInternal(bool synchronous) { if (!this.HasOperationTimedOut()) { try { IAsyncResult result; using (this.PrepareTransactionalCall(this.dependentTransaction)) { AsyncCallback wrappedCallback = this.PrepareAsyncCompletion(onExecuteReaderCallback); this.sqlCommand.Connection = StoreUtilities.CreateConnection(this.connectionString); if (!this.HasOperationTimedOut()) { result = this.sqlCommand.BeginExecuteReader(wrappedCallback, this, CommandBehavior.CloseConnection); } else { this.sqlCommand.Connection.Close(); this.Complete(synchronous, new TimeoutException(SR.TimeoutOnSqlOperation(this.timeoutHelper.OriginalTimeout.ToString()))); return; } } if (this.CheckSyncContinue(result)) { if (this.CompleteExecuteReader(result)) { this.Complete(synchronous); } } return; } catch (SqlException exception) { if (TD.SqlExceptionCaughtIsEnabled()) { TD.SqlExceptionCaught(this.eventTraceActivity, exception.Number.ToString(null, CultureInfo.InvariantCulture), exception.Message); } if (this.sqlCommand.Connection != null) { this.sqlCommand.Connection.Close(); } if (!this.CheckRetryCount() || !ShouldRetryForSqlError(exception.Number, RetryErrorOptions.RetryOnBegin)) { throw; } if (TD.RetryingSqlCommandDueToSqlErrorIsEnabled()) { TD.RetryingSqlCommandDueToSqlError(this.eventTraceActivity, exception.Number.ToString(CultureInfo.InvariantCulture)); } } catch (InvalidOperationException) { if (!this.CheckRetryCount()) { throw; } } if (this.EnqueueRetry()) { return; } } if (this.HasOperationTimedOut()) { if (TD.TimeoutOpeningSqlConnectionIsEnabled()) { TD.TimeoutOpeningSqlConnection(this.eventTraceActivity, this.timeoutHelper.OriginalTimeout.ToString()); } } else { if (TD.MaximumRetriesExceededForSqlCommandIsEnabled()) { TD.MaximumRetriesExceededForSqlCommand(this.eventTraceActivity); } } this.Complete(synchronous, new TimeoutException(SR.TimeoutOnSqlOperation(this.timeoutHelper.OriginalTimeout.ToString()))); }
protected override Exception ProcessSqlResult(SqlDataReader reader) { Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader); if (nextResultSet == null) { Guid instanceId = reader.GetGuid(1); reader.GetInt64(2); byte[] primitiveDataProperties = reader.IsDBNull(3) ? null : ((byte[])reader.GetValue(3)); byte[] complexDataProperties = reader.IsDBNull(4) ? null : ((byte[])reader.GetValue(4)); byte[] serializedMetadataProperties = reader.IsDBNull(5) ? null : ((byte[])reader.GetValue(5)); InstanceEncodingOption @byte = (InstanceEncodingOption)reader.GetByte(6); InstanceEncodingOption instanceEncodingOption = (InstanceEncodingOption)reader.GetByte(7); long instanceVersion = reader.GetInt64(8); bool boolean = reader.GetBoolean(9); bool flag2 = reader.GetBoolean(10); InstancePersistenceCommand instancePersistenceCommand = base.InstancePersistenceCommand; LoadWorkflowByInstanceKeyCommand command = base.InstancePersistenceCommand as LoadWorkflowByInstanceKeyCommand; if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstance) { base.InstancePersistenceContext.BindInstance(instanceId); } if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstanceOwner) { base.InstancePersistenceContext.BindInstanceOwner(base.StoreLock.LockOwnerId, base.StoreLock.LockOwnerId); } if (!base.InstancePersistenceContext.InstanceView.IsBoundToLock) { ((InstanceLockTracking)base.InstancePersistenceContext.UserContext).TrackStoreLock(instanceId, instanceVersion, base.DependentTransaction); base.InstancePersistenceContext.BindAcquiredLock(instanceVersion); } this.instanceData = SerializationUtilities.DeserializePropertyBag(primitiveDataProperties, complexDataProperties, @byte); this.instanceMetadata = SerializationUtilities.DeserializeMetadataPropertyBag(serializedMetadataProperties, instanceEncodingOption); if (!flag2) { this.ReadInstanceMetadataChanges(reader, this.instanceMetadata); this.ReadKeyData(reader, this.associatedInstanceKeys, this.completedInstanceKeys); } else if (command != null) { foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > pair in command.InstanceKeysToAssociate) { this.associatedInstanceKeys.Add(pair.Key, pair.Value); } if (!this.associatedInstanceKeys.ContainsKey(command.LookupInstanceKey)) { base.InstancePersistenceContext.AssociatedInstanceKey(command.LookupInstanceKey); this.associatedInstanceKeys.Add(command.LookupInstanceKey, new Dictionary <XName, InstanceValue>()); } } if (command != null) { foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > pair2 in command.InstanceKeysToAssociate) { base.InstancePersistenceContext.AssociatedInstanceKey(pair2.Key); if (pair2.Value != null) { foreach (KeyValuePair <XName, InstanceValue> pair3 in pair2.Value) { base.InstancePersistenceContext.WroteInstanceKeyMetadataValue(pair2.Key, pair3.Key, pair3.Value); } } } } base.InstancePersistenceContext.LoadedInstance(boolean ? InstanceState.Initialized : InstanceState.Uninitialized, this.instanceData, this.instanceMetadata, this.associatedInstanceKeys, this.completedInstanceKeys); return(nextResultSet); } if (nextResultSet is InstanceLockLostException) { base.InstancePersistenceContext.InstanceHandle.Free(); } return(nextResultSet); }