예제 #1
0
 protected void apply(VersionedEvent e)
 {
     e.Version = version + 1;
     handlers[e.GetType()].Invoke(e);
     version = e.Version;
     pendingEvents.Add(e);
 }
예제 #2
0
 protected void Update(VersionedEvent e)
 {
     e.SourceId = Id;
     e.Version  = version + 1;
     handlers[e.GetType()].Invoke(e);
     version = e.Version;
     pendingEvents.OnNext(e);
 }
        private void UpdatePapierSettingPersoon(VersionedEvent @event, Expression <Func <RM.PapierSettingPersoon, bool> > rmRecordSelection)
        {
            using (var db = _queryContextFactory())
            {
                var PapierSettingPersoon = db.PapierSettingsPersoon.FirstOrDefault(rmRecordSelection);

                if (PapierSettingPersoon == null)
                {
                    throw new Exception(string.Format("Geen PapierSettingPersoon gevonden met AR Id '{0}' bij het projecteren van een '{1}' applicatie event.",
                                                      @event.AggregateId, @event.GetType().ToString()));
                }

                CheckVersionProjectAndUpdate(PapierSettingPersoon, @event, db);
            }
        }
예제 #4
0
 public void ApplyEvent(VersionedEvent @event)
 {
     Version = @event.Version;
     _applyMethods[@event.GetType()](@event);
 }
예제 #5
0
 public AggregateRecoveryException(VersionedEvent @event)
     : base(string.Format("Could not recover from event type '{0}'", @event.GetType().FullName))
 {
 }
 private void CheckVersionProjectAndUpdate(RM.PapierSettingPersoon rm, VersionedEvent @event, QueryContext db)
 {
     if (CheckEventVersion(rm.Version, @event.Version))
     {
         _projections.Project(ref rm, @event);
         db.SaveChanges();
     }
     else
     {
         throw new Exception(string.Format("Kan PapierSettingPersoon '{0}', versie {1} niet updaten. Versie van het '{2}' applicatie event is {3}.",
                                           rm.PapierSettingPersoonId, rm.Version, @event.GetType().ToString(), @event.Version));
     }
 }