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

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

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

            await _context.BulkMergeAsync(
                toMerge,
                opt => opt.MergeKeepIdentity = true);
        }
Beispiel #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;
            });
        }