Пример #1
0
        protected bool ApplyChangeSet(AggregateRootChangeSet changeSet, bool ignoreConflicts = false)
        {
            var type = changeSet.Aggregate.GetType();

            var targetVersion = ignoreConflicts ? (long?) null : changeSet.TargetVersion;

            if (changeSet.IsDeleted)
                return _dataSession.RemoveOne(type, changeSet.Aggregate.IdObject, targetVersion);

            return _dataSession.SaveOne(changeSet.Aggregate, targetVersion);
        }
Пример #2
0
 protected void RegisterEvent(IUncommitedEvent ev)
 {
     AggregateRootChangeSet changeSet;
     if (!ChangeSets.TryGetValue(ev.Target, out changeSet))
     {
         changeSet = new AggregateRootChangeSet(ev.Target);
         ChangeSets.Add(ev.Target, changeSet);
     }
     changeSet.Register(ev);
 }