Exemplo n.º 1
0
 public BatchSubmissionFeedbackService(
     BatchesContext batchesContext,
     ILogger <BatchSubmissionFeedbackService> logger)
 {
     _batchesContext = batchesContext;
     _logger         = logger;
 }
Exemplo n.º 2
0
 public BatchVettingService(
     BatchesContext batchesContext,
     ILogger <BatchVettingService> logger)
 {
     _batchesContext = batchesContext;
     _logger         = logger;
 }
 public GetBatchSubmissionStatusQueryHandler(
     BatchesContext batchesContext,
     IObjectsStorageService objectsStorageService)
 {
     _batchesContext        = batchesContext;
     _objectsStorageService = objectsStorageService;
 }
 public BatchRepository(
     BatchesContext batchesContext,
     IObjectsStorageService objectsStorageService)
 {
     _batchesContext        = batchesContext;
     _objectsStorageService = objectsStorageService;
 }
Exemplo n.º 5
0
 public BatchesController(
     IBatchSubmissionService batchSubmissionService,
     BatchesContext batchesContext)
 {
     _batchSubmissionService = batchSubmissionService;
     _batchesContext         = batchesContext;
 }
 public BatchesController(
     IBatchSubmissionService batchSubmissionService,
     BatchesContext batchesContext,
     ILogger <BatchesController> logger)
 {
     _batchSubmissionService = batchSubmissionService;
     _batchesContext         = batchesContext;
     _logger = logger;
 }
Exemplo n.º 7
0
 public BatchSubmissionFeedbackService(
     IHttpClientFactory httpClientFactory,
     BatchesContext batchesContext,
     ILogger <BatchSubmissionFeedbackService> logger)
 {
     _httpClientFactory = httpClientFactory;
     _batchesContext    = batchesContext;
     _logger            = logger;
 }
 public BatchSubmissionService(
     IObjectsStorageService objectsStorageService,
     IBackgroundJobClient backgroundJobClient,
     BatchesContext batchesContext,
     ILogger <BatchSubmissionService> logger)
 {
     _objectsStorageService = objectsStorageService;
     _backgroundJobClient   = backgroundJobClient;
     _batchesContext        = batchesContext;
     _logger = logger;
 }
Exemplo n.º 9
0
        private static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BatchesContext(
                       serviceProvider.GetRequiredService <DbContextOptions <BatchesContext> >(),
                       serviceProvider.GetRequiredService <IMediator>()))
            {
                if (context.BatchVettingStatuses.Any())
                {
                    return;
                }

                context.AddRange(
                    BatchVettingStatus.Started,
                    BatchVettingStatus.Rejected,
                    BatchVettingStatus.Accepted,
                    BatchVettingStatus.AcceptedWithWarnings);

                context.SaveChanges();
            }
        }
        public static async Task DispatchDomainEventsAsync(this IMediator mediator, BatchesContext ctx)
        {
            var domainEntities = ctx.ChangeTracker
                                 .Entries <Entity>()
                                 .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any())
                                 .ToList();

            var domainEvents = domainEntities
                               .SelectMany(x => x.Entity.DomainEvents)
                               .ToList();

            domainEntities
            .ForEach(entity => entity.Entity.ClearDomainEvents());

            var tasks = domainEvents
                        .Select(async(domainEvent) => {
                await mediator.Publish(domainEvent);
            });

            await Task.WhenAll(tasks);
        }