Exemple #1
0
        /// <summary>
        /// Save Reporting Data
        /// </summary>
        /// <param name="reportingrepository"></param>
        public void Handle(PersonCreatedEvent evt)
        {
            var person = new Person
            {
                Id        = evt.Id,
                LastName  = evt.LastName,
                FirstName = evt.FirstName,
                Age       = evt.Age
            };

            _reportingRepository.Add <Person>(person);
        }
        private void HandlePropertyRegisteredDomainEvent(IDomainEvent @event)
        {
            if (@event is PropertyRegisteredDomainEvent)
            {
                var ev = @event as PropertyRegisteredDomainEvent;

                _reportingRepository.Add(new Property()
                {
                    Id    = @ev.PropertyId,
                    Name  = @ev.Name,
                    Price = @ev.Price
                });

                _logger.InfoFormat("Normalising: New Property added! {0}", @ev.PropertyId);

                // pass this onto the UI, whatever...
                Task.Run(() => _reportingUpdatesBus.Publish(ReportingUpdateType.Property));
            }
            else
            {
                var type = @event == null ? null : @event.GetType();
                _logger.WarnFormat("Normalising: failed, event was not the expected type! {0}", type);
            }
        }