예제 #1
0
        /// <summary>
        /// Waits for the workflow to complete or throws an error exception.  Use this for 
        /// workflows that don't return a result.
        /// </summary>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        public async Task GetResultAsync()
        {
            await SyncContext.Clear;
            EnsureStarted();

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

            await client.GetWorkflowResultAsync(Execution, client.ResolveDomain(Options?.Domain));
        }
예제 #2
0
        /// <summary>
        /// Attempts to retrieve the associated workflow result.
        /// </summary>
        /// <typeparam name="TResult">The result type.</typeparam>
        /// <returns>The result.</returns>
        public async Task <TResult> GetResultAsync <TResult>()
        {
            await SyncContext.ClearAsync;

            EnsureStarted();

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

            return(client.DataConverter.FromData <TResult>(await client.GetWorkflowResultAsync(Execution, client.ResolveDomain(Options?.Domain))));
        }
예제 #3
0
        /// <summary>
        /// Waits for the workflow complete if necessary, without returning the result.
        /// </summary>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        public async Task GetResultAsync()
        {
            await SyncContext.ClearAsync;

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

                await stub.GetResultAsync(Execution);
            }
            else
            {
                await client.GetWorkflowResultAsync(Execution, domain);
            }
        }
예제 #4
0
        /// <summary>
        /// Waits for the workflow to complete.
        /// </summary>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        public async Task GetAsync()
        {
            await SyncContext.Clear;

            if (completed)
            {
                throw new InvalidOperationException($"[{nameof(IAsyncFuture<object>)}.GetAsync()] may only be called once per stub instance.");
            }

            completed = true;

            await client.GetWorkflowResultAsync(Execution, domain);
        }
예제 #5
0
        /// <inheritdoc/>
        public async Task <TResult> GetResultAsync <TResult>()
        {
            EnsureStarted();

            return(client.DataConverter.FromData <TResult>(await client.GetWorkflowResultAsync(Execution, domain)));
        }