Example #1
0
        public static async Task DispatchDomainEventsAsync(this IMediator mediator, OrderLunchContext context)
        {
            var domainEntities = context.ChangeTracker
                                 .Entries <BaseEntity>().Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any());

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

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

            foreach (var domainEvent in domainEvents)
            {
                await mediator.Publish(domainEvent);
            }
        }
Example #2
0
 public MenuRepository(OrderLunchContext dbContext) : base(dbContext)
 {
 }
 public BasketRepository(OrderLunchContext context)
 {
     _dbContext = context ?? throw new ArgumentNullException(nameof(context));
 }
Example #4
0
 public RequestManager(OrderLunchContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Example #5
0
 public BuyerRepository(OrderLunchContext dbContext) : base(dbContext)
 {
 }
Example #6
0
 public SupplierRepository(OrderLunchContext dbContext) : base(dbContext)
 {
 }