當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。