protected async Task <BatchOperationResultDetail <T> > FetchDetail(Func <string[], Task <IEnumerable <T> > > fetchEntities, CancellationToken cancellationToken = default(CancellationToken)) { BusinessProcessDetailsDataBatchResponse batchResult; if (!string.IsNullOrEmpty(BusinessProcessId)) { var details = await _businessProcessClient.GetDetailsAsync(BusinessProcessId, cancellationToken).ConfigureAwait(false); batchResult = details.Details as BusinessProcessDetailsDataBatchResponse; } else { batchResult = new BusinessProcessDetailsDataBatchResponse() { Response = new BatchResponse { Rows = new List <BatchResponseRow>() } }; } if (batchResult == null) { throw new InvalidOperationException("BusinessProcess did not return a BatchResponse"); } return(new BatchOperationResultDetail <T>(batchResult, fetchEntities)); }
internal BatchOperationResultDetail(BusinessProcessDetailsDataBatchResponse details, Func <string[], Task <IEnumerable <T> > > fetchEntities) { FailedItems = details.Response.Rows.Where(r => !r.Succeeded).ToArray(); FailedIds = FailedItems.Select(i => i.Id).ToArray(); SucceededIds = details.Response.Rows.Where(r => r.Succeeded).Select(i => i.Id).ToArray(); SucceededItems = new BatchOperationResultCollection <T>(details, fetchEntities); }
public BatchOperationResultCollection(BusinessProcessDetailsDataBatchResponse details, Func <string[], Task <IEnumerable <T> > > fetchEntities) { _fetchEntities = fetchEntities; _ids = details.Response.Rows.Where(r => r.Succeeded).Select(r => r.Id).ToArray(); }