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 { }); }
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.")); } }
public void AddEventSourcing(Message command, string actionName, object data) { var @event = EventEntity.GetEvent(actionName, command, "Marcos", data); _eventSourcingContext.SaveEvent(@event); }
public void AddEventSourcing(Message command, string actionName, Message lastCommand = null) { var @event = EventEntity.GetEvent(actionName, command, "Marcos", lastCommand); _eventSourcingContext.SaveEvent(@event); }