コード例 #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);
 }
コード例 #3
0
        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
ファイル: AggregateRoot.cs プロジェクト: Hydrakus/Euricom
 public AggregateRecoveryException(VersionedEvent @event)
     : base(string.Format("Could not recover from event type '{0}'", @event.GetType().FullName))
 {
 }
コード例 #6
0
 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));
     }
 }