Esempio n. 1
0
        /// <summary>
        /// Attempts to cancel the associated workflow.
        /// </summary>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        public async Task CancelAsync()
        {
            await SyncContext.Clear;

            EnsureStarted();

            if (Execution == null)
            {
                throw new InvalidOperationException("The stub can't cancel the workflow because it doesn't have the workflow execution.");
            }

            await client.CancelWorkflowAsync(Execution, client.ResolveNamespace(Options?.Namespace));
        }
Esempio n. 2
0
        /// <summary>
        /// Cancels the workflow.
        /// </summary>
        public async Task CancelAsync()
        {
            await SyncContext.Clear;

            if (parentWorkflow != null)
            {
                var stub = parentWorkflow.NewLocalActivityStub <ILocalOperations, LocalOperations>();

                await stub.CancelAsync(Execution);
            }
            else
            {
                await client.CancelWorkflowAsync(Execution, @namespace);
            }
        }