/// <summary>
        /// Awaits for the operation to complete succesfully.
        /// </summary>
        /// <param name="operation">The operation to await.</param>
        /// <returns>The task that will be done once the operation is succesful.</returns>
        public async Task AwaitOperationAsync(Operation operation)
        {
            var completedOperation = await Polling <Operation> .Poll(
                operation,
                o => GetOperationAsync(o.Name),
                o => o.Status == OperationStateDone);

            if (completedOperation.Error != null)
            {
                throw new DataSourceException(completedOperation.Error.Errors.FirstOrDefault()?.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// Awaits for the operation to complete succesfully.
        /// </summary>
        /// <param name="operation">The operation to await.</param>
        /// <returns>The task that will be done once the operation is succesful.</returns>
        public async Task AwaitOperationAsync(Operation operation)
        {
            var completedOperation = await Polling <Operation> .Poll(
                operation,
                o => GetOperationAsync(o.GetOperationId()),
                o => o.Done ?? false);

            if (completedOperation.Error != null)
            {
                throw new DataSourceException(completedOperation.Error.Message);
            }
        }