Ejemplo n.º 1
0
        public void Handle(MeetingCreated @event)
        {
            using (var session = _documentStore.OpenSession())
            {
                var doc = new MeetingDocument
                {
                    DocumentId   = @event.AggregateId,
                    Name         = @event.Name,
                    Owner        = @event.OwnerId,
                    CreationDate = @event.CreationDate
                };

                session.Store(doc);
                session.SaveChanges();

                _bus.PublishNotification(doc);
            }
        }
Ejemplo n.º 2
0
        public void Handle(UserCreated @event)
        {
            using (var session = _documentStore.OpenSession())
            {
                var doc = new UserDocument
                {
                    DocumentId = @event.AggregateId,
                    Nick       = @event.Nick,
                    FirstName  = @event.FirstName,
                    LastName   = @event.LastName,
                    Email      = @event.Email
                };

                doc.AccountAssociations.Add(new AccountAssociationDocument {
                    Identity = @event.AccountIdentity, Network = @event.Network
                });
                session.Store(doc);
                session.SaveChanges();
                _bus.PublishNotification(doc);
            }
        }