Exemplo n.º 1
0
        public async Task <LearningProviderRates> ResolveAsync <TContext>(ResolveFieldContext <TContext> context)
        {
            var entityId = BuildEntityId(context);

            try
            {
                var request = new LoadLearningProviderRatesRequest
                {
                    EntityReferences = new[]
                    {
                        new AggregateEntityReference
                        {
                            AdapterRecordReferences = new[]
                            {
                                new EntityReference
                                {
                                    SourceSystemId   = entityId,
                                    SourceSystemName = SourceSystemNames.Rates,
                                },
                            }
                        },
                    },
                    Live = _executionContextManager.GraphExecutionContext.QueryLive,
                };
                var rates = await _entityRepository.LoadLearningProviderRatesAsync(request, context.CancellationToken);

                return(rates.SquashedEntityResults.FirstOrDefault()?.SquashedEntity);
            }
            catch (Exception ex)
            {
                _logger.Error($"Error resolving rates for {entityId}: {ex.Message}", ex);
                throw;
            }
        }
Exemplo n.º 2
0
 public async Task <EntityCollection <LearningProviderRates> > LoadLearningProviderRatesAsync(LoadLearningProviderRatesRequest request, CancellationToken cancellationToken)
 {
     return(await LoadAsync <LearningProviderRates>(request, cancellationToken));
 }