Пример #1
0
        private void AddEvent(ICommand command, Guid aggregateId)
        {
            var json = EventEntity.GetEvent("Customer Created", aggregateId, command, "Marcos");
            var sb   = new StringBuilder()
                       .AppendLine($"INSERT INTO EventEntities (Id, Action, AggregateId, Assembly, Data, When, Who)" + " VALUES " +
                                   $"(\"{Guid.NewGuid()}\", \"Customer Created\", \"{aggregateId}\", \"_\" , \"'{json.Data}'\", \"{DateTime.Now}\", \"Marcos\")");

            _eventSourcingContext.Connection.Execute(sb.ToString(), new { });
        }
Пример #2
0
        protected void Commit(Guid aggregateId, ICommand command, string action, object lastEntity = null)

        {
            if (true)
            {
                var eventEntity = EventEntity.GetEvent(action, aggregateId, command, "Marcos", lastEntity);

                if (JObject.Parse(eventEntity.Data).HasValues)
                {
                    AddEvent(command, aggregateId);
                }
            }
            else
            {
                AddNotification(new DomainNotification("Commit", "We had a problem during saving your data."));
            }
        }
        protected void Commit(Entity entity, ICommand command, string action, object lastEntity = null)
        {
            if (_notifications.HasNotifications())
            {
                return;
            }
            if (_architectureContext.SaveChanges() > 0)
            {
                var eventEntity = EventEntity.GetEvent(
                    action, entity, command, _authService.UserLoggedIn, lastEntity);

                _eventSourcingContext.EventEntities.Add(eventEntity);
                var teste = JObject.Parse(eventEntity.Data);
                if (JObject.Parse(eventEntity.Data).HasValues)
                {
                    _eventSourcingContext.SaveChanges();
                }
            }
            else
            {
                AddNotification(new DomainNotification("Commit", "We had a problem during saving your data."));
            }
        }
Пример #4
0
        public void AddEventSourcing(Message command, string actionName, object data)
        {
            var @event = EventEntity.GetEvent(actionName, command, "Marcos", data);

            _eventSourcingContext.SaveEvent(@event);
        }
Пример #5
0
        public void AddEventSourcing(Message command, string actionName, Message lastCommand = null)
        {
            var @event = EventEntity.GetEvent(actionName, command, "Marcos", lastCommand);

            _eventSourcingContext.SaveEvent(@event);
        }