TrackStoreUnlock() public method

public TrackStoreUnlock ( DependentTransaction dependentTransaction ) : void
dependentTransaction DependentTransaction
return void
        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);
        }
Example #2
0
        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);
        }