public void Apply(SiteCreatedEvent @event) { this.Name = @event.Name; this.Description = @event.Description; this.Active = @event.Active; this.TenantId = new TenantId(@event.TenantId); }
public async Task Handle(SiteCreatedEvent notification, CancellationToken cancellationToken) { try { var desiredState = notification.Site.Machine.States.First(x => x.Desired); _context.Set <HistoricalDesiredState>().Add(Mapper.Map <HistoricalDesiredState>(desiredState)); await _context.SaveChangesAsync(cancellationToken); } catch (Exception e) { _logger.LogError(e.Message); } }