public DataChangeSet SaveChanges(StaleDataPolicy staleDataPolicy) { var appliedEvents = new List<IAggregateEvent>(); var staleData = new List<IAggregateRoot>(); foreach (var changeSet in ChangeSets.Values) { if (ApplyChangeSet(changeSet, staleDataPolicy == StaleDataPolicy.Ignore)) { appliedEvents.AddRange(changeSet.GetStreamOfEvents()); } else { staleData.Add(changeSet.Aggregate); } } ChangeSets.Clear(); return new DataChangeSet(appliedEvents, staleData); }
public IUnitOfWork Build(StaleDataPolicy staleDataPolicy) { return new UnitOfWorkContext(OpenDomainSession(), staleDataPolicy); }
public static IUnitOfWork Start(StaleDataPolicy? staleDataPolicy = null) { return Manager.Start(staleDataPolicy); }
public void OnStaleData(StaleDataPolicy policy) { StaleDataPolicy = policy; }