当前位置: 首页>>代码示例>>C#>>正文


C# Dispatcher.WorkflowServiceInstance类代码示例

本文整理汇总了C#中System.ServiceModel.Activities.Dispatcher.WorkflowServiceInstance的典型用法代码示例。如果您正苦于以下问题:C# WorkflowServiceInstance类的具体用法?C# WorkflowServiceInstance怎么用?C# WorkflowServiceInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorkflowServiceInstance类属于System.ServiceModel.Activities.Dispatcher命名空间,在下文中一共展示了WorkflowServiceInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransactionContext

        public TransactionContext(WorkflowServiceInstance durableInstance, Transaction currentTransaction)
        {
            Fx.Assert(durableInstance != null, "Null DurableInstance passed to TransactionContext.");
            Fx.Assert(currentTransaction != null, "Null Transaction passed to TransactionContext.");

            this.currentTransaction = currentTransaction.Clone();
            this.durableInstance = durableInstance;
            this.currentTransaction.EnlistVolatile(this, EnlistmentOptions.EnlistDuringPrepareRequired);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:TransactionContext.cs

示例2: WorkflowOperationContext

 private WorkflowOperationContext(object[] inputs, System.ServiceModel.OperationContext operationContext, string operationName, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.inputs = inputs;
     this.operationName = operationName;
     this.OperationContext = operationContext;
     this.CurrentTransaction = currentTransaction;
     this.performanceCountersEnabled = performanceCountersEnabled;
     this.propagateActivity = propagateActivity;
     this.timeoutHelper = new TimeoutHelper(timeout);
     this.workflowInstance = workflowInstance;
     this.thisLock = new object();
     this.notification = notification;
     base.OnCompleting = onCompleting;
     this.bookmark = behavior.OnResolveBookmark(this, out this.bookmarkScope, out this.bookmarkValue);
     bool flag = false;
     try
     {
         if (TraceUtility.MessageFlowTracingOnly)
         {
             this.e2eActivityId = TraceUtility.GetReceivedActivityId(this.OperationContext);
             DiagnosticTrace.ActivityId = this.e2eActivityId;
         }
         if (this.workflowInstance.BufferedReceiveManager != null)
         {
             ReceiveContext.TryGet(this.OperationContext.IncomingMessageProperties, out this.receiveContext);
             this.OperationContext.IncomingMessageProperties.Remove(ReceiveContext.Name);
         }
         flag = this.ProcessRequest();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         base.OnCompleting(this, exception);
         throw;
     }
     if (flag)
     {
         base.Complete(true);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:43,代码来源:WorkflowOperationContext.cs

示例3: OnEndServiceOperation

 protected virtual object OnEndServiceOperation(WorkflowServiceInstance durableInstance, out object[] outputs, IAsyncResult result)
 {
     return ServiceOperationAsyncResult.End(out outputs, result);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:4,代码来源:ControlOperationInvoker.cs

示例4: UnlockAndAbortAsyncResult

                public UnlockAndAbortAsyncResult(WorkflowServiceInstance instance, TimeSpan timeout, AsyncCallback callback, object state)
                    : base(callback, state)
                {
                    this.instance = instance;
                    this.timeoutHelper = new TimeoutHelper(timeout);
                    this.OnCompleting = onCompleting;

                    Exception completionException = null;
                    bool completeSelf = true;

                    if (this.instance.acquireReferenceSemaphore.EnterAsync(this.timeoutHelper.RemainingTime(), acquireCompletedCallback, this))
                    {
                        try
                        {
                            completeSelf = this.HandleEndAcquireReference();
                        }
                        catch (Exception exception)
                        {
                            if (Fx.IsFatal(exception))
                            {
                                throw;
                            }
                            completionException = exception;
                        }
                    }
                    else
                    {
                        completeSelf = false;
                    }

                    if (completeSelf)
                    {
                        Complete(true, completionException);
                    }
                }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:WorkflowServiceInstance.cs

示例5: WorkflowPersistenceContext

            public WorkflowPersistenceContext(WorkflowServiceInstance instance, bool transactionRequired, Transaction transactionToUse, TimeSpan transactionTimeout)
            {
                this.instance = instance;

                if (transactionToUse != null)
                {
                    this.clonedTransaction = transactionToUse;
                }
                else if (transactionRequired)
                {
                    this.contextOwnedTransaction = new CommittableTransaction(transactionTimeout);
                    // Clone it so that we don't pass a CommittableTransaction to the participants
                    this.clonedTransaction = this.contextOwnedTransaction.Clone();
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:WorkflowServiceInstance.cs

示例6: WorkflowExecutionLock

 public WorkflowExecutionLock(WorkflowServiceInstance instance)
 {
     this.instance = instance;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:WorkflowServiceInstance.cs

示例7: AbandonAndSuspendAsyncResult

 AbandonAndSuspendAsyncResult(WorkflowServiceInstance instance, Exception reason, AsyncCallback callback, object state)
     : base(instance, null, callback, state)
 {
     this.reason = reason;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:WorkflowServiceInstance.cs

示例8: Create

 public static AbandonAsyncResult Create(WorkflowServiceInstance instance, Exception reason, bool shouldTrackAbort, TimeSpan timeout, AsyncCallback callback, object state)
 {
     AbandonAsyncResult result = new AbandonAsyncResult(instance, reason, shouldTrackAbort, callback, state);
     result.Run(timeout);
     return result;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:6,代码来源:WorkflowServiceInstance.cs

示例9: AbandonAsyncResult

 AbandonAsyncResult(WorkflowServiceInstance instance, Exception reason, bool shouldTrackAbort, AsyncCallback callback, object state)
     : base(instance, null, callback, state)
 {
     this.reason = reason;
     this.shouldTrackAbort = shouldTrackAbort;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:6,代码来源:WorkflowServiceInstance.cs

示例10: TerminateAsyncResult

 TerminateAsyncResult(WorkflowServiceInstance instance, Exception reason, Transaction transaction, AsyncCallback callback, object state)
     : base(instance, transaction, callback, state)
 {
     this.reason = reason;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:WorkflowServiceInstance.cs

示例11: SimpleOperationAsyncResult

 protected SimpleOperationAsyncResult(WorkflowServiceInstance instance, Transaction transaction, AsyncCallback callback, object state)
     : base(callback, state)
 {
     this.instance = instance;
     this.OperationTransaction = transaction;
     this.OnCompleting = onCompleting;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:WorkflowServiceInstance.cs

示例12: UnloadOrPersistAsyncResult

            public UnloadOrPersistAsyncResult(WorkflowServiceInstance instance, PersistenceOperation operation,
                bool isWorkflowThread, bool isTry, TimeSpan timeout, AsyncCallback callback, object state)
                : base(callback, state)
            {
                // The isTry flag is only true when this is an idle policy initiated persist/unload.
                
                Fx.Assert((isWorkflowThread && !isTry) || !isWorkflowThread, "Either we're the workflow thread and NOT a try or we're not a workflow thread.");

                this.instance = instance;
                this.timeoutHelper = new TimeoutHelper(timeout);
                this.operation = operation;
                this.isWorkflowThread = isWorkflowThread;
                this.isTry = isTry;
                this.tryResult = true;
                this.isUnloaded = (operation == PersistenceOperation.Unload || operation == PersistenceOperation.Delete);
                this.saveStatus = SaveStatus.Locked;
                this.isCompletionTransactionRequired = this.isUnloaded && instance.Controller.State == WorkflowInstanceState.Complete && 
                    instance.creationContext != null && instance.creationContext.IsCompletionTransactionRequired;
                this.isIdlePolicyPersist = isTry && operation == PersistenceOperation.Save;

                if (operation == PersistenceOperation.Unload)
                {
                    this.saveStatus = SaveStatus.Unlocked;
                }
                else if (operation == PersistenceOperation.Delete)
                {
                    this.saveStatus = SaveStatus.Completed;
                }
                else if (operation == PersistenceOperation.Save)
                {
                    SetStartTime();
                }
                
                // Save off the current transaction in case we have an async operation before we end up creating
                // the WorkflowPersistenceContext and create it on another thread. Do a simple clone here to prevent
                // the object referenced by Transaction.Current from disposing before we get around to referencing it
                // when we create the WorkflowPersistenceContext.
                //
                // This will throw TransactionAbortedException by design, if the transaction is already rolled back.
                Transaction currentTransaction = Transaction.Current;
                if (currentTransaction != null)
                {
                    OnCompleting = UnloadOrPersistAsyncResult.completeCallback;
                    this.dependentTransaction = currentTransaction.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
                }

                bool completeSelf = true;
                bool success = false;
                try
                {
                    if (this.isWorkflowThread)
                    {
                        Fx.Assert(this.instance.Controller.IsPersistable, "The runtime won't schedule this work item unless we've passed the guard");

                        // We're an internal persistence on the workflow thread which means
                        // that we are passed the guard already, we have the lock, and we know
                        // we aren't detached.

                        completeSelf = OpenProvider();
                    }
                    else
                    {
                        try
                        {
                            completeSelf = LockAndPassGuard();
                        }
                        finally
                        {
                            if (completeSelf)
                            {
                                Fx.Assert(!this.isWorkflowThread, "We should never be calling ReleaseLock if this is the workflow thread.");

                                this.instance.ReleaseLock(ref this.ownsLock, this.isIdlePolicyPersist && this.tryResult);
                            }
                        }
                    }
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        if (this.dependentTransaction != null)
                        {
                            this.dependentTransaction.Complete();
                        }
                    }
                }

                if (completeSelf)
                {
                    Complete(true);
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:94,代码来源:WorkflowServiceInstance.cs

示例13: AcquireLockOnIdleAsyncResult

            public AcquireLockOnIdleAsyncResult(WorkflowServiceInstance instance, TimeSpan timeout, ref bool ownsLock, AsyncCallback callback, object state)
                : base(callback, state)
            {
                Fx.Assert(!ownsLock, "We should never call acquire if we already think we own the lock.");

                // We cannot just hand off the lock if we are in a handler thread
                // because this might eventually go async (during the operation)
                // and we could have multiple operations occurring concurrently.

                this.instance = instance;
                this.timeoutHelper = new TimeoutHelper(timeout);

                bool incrementedActiveOperations = false;
                bool decrementActiveOperations = true;
                bool completeSelf = true;
                object lockToken = null;

                try
                {
                    lock (this.instance.activeOperationsLock)
                    {
                        try
                        {
                        }
                        finally
                        {
                            this.instance.activeOperations++;
                            incrementedActiveOperations = true;
                        }

                        this.instance.executorLock.SetupWaiter(ref lockToken);
                    }

                    completeSelf = this.instance.executorLock.EnterAsync(this.timeoutHelper.RemainingTime(), ref lockToken, ref ownsLock, lockAcquiredCallback, this);

                    // We don't want to decrement the count if we went async
                    // because the async callback will do the decrement
                    decrementActiveOperations = completeSelf;
                }
                finally
                {
                    if (incrementedActiveOperations && decrementActiveOperations)
                    {
                        lock (this.instance.activeOperationsLock)
                        {
                            this.instance.activeOperations--;
                        }
                    }

                    this.instance.executorLock.CleanupWaiter(lockToken, ref ownsLock);
                }

                if (completeSelf)
                {
                    if (CheckState(ref ownsLock))
                    {
                        Complete(true);
                    }
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:WorkflowServiceInstance.cs

示例14: WaitForCanPersistAsyncResult

            public WaitForCanPersistAsyncResult(WorkflowServiceInstance instance, ref bool ownsLock, TimeSpan timeout, AsyncCallback callback, object state)
                : base(callback, state)
            {
                this.instance = instance;
                this.ownsLock = ownsLock;
                this.timeoutHelper = new TimeoutHelper(timeout);

                Fx.Assert(ownsLock, "Must be called under locked!");

                if (WaitForCanPersist())
                {
                    Complete(true);
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:WorkflowServiceInstance.cs

示例15: UnhandledExceptionAsyncData

 public UnhandledExceptionAsyncData(WorkflowServiceInstance instance, Exception exception, Activity exceptionSource)
 {
     this.Instance = instance;
     this.Exception = exception;
     this.ExceptionSource = exceptionSource;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:6,代码来源:WorkflowServiceInstance.cs


注:本文中的System.ServiceModel.Activities.Dispatcher.WorkflowServiceInstance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。