Exemple #1
0
        public async Task Handle(PartnersChanged @event)
        {
            var deleted = @event.Deleted;

            await _context.Partners
            .Where(x => deleted.Contains(x.Id))
            .DeleteFromQueryAsync();

            var toMergeDto = @event.Created.Concat(@event.Updated);
            var toMerge    = toMergeDto
                             .Select(Mapper.Map <Partners>)
                             .ToList();

            await _context.BulkMergeAsync(
                toMerge,
                opt => opt.MergeKeepIdentity = true);
        }
Exemple #2
0
        public async Task Handle(AreasChanged @event)
        {
            var deleted = @event.Deleted;

            await _context.Areas
            .Where(x => deleted.Contains(x.Id))
            .DeleteFromQueryAsync();

            var toMergeDto = @event.Created.Concat(@event.Updated);
            var toMerge    = toMergeDto
                             .Select(Mapper.Map <Area>)
                             .ToList();

            await _context.BulkMergeAsync(
                toMerge,
                opt =>
            {
                opt.MergeKeepIdentity = true;
                opt.IncludeGraph      = true;
            });
        }