示例#1
0
        /// <summary>
        /// Appends a new commit to the event store.
        /// </summary>
        /// <param name="commit">The commit to append to the event store.</param>
        public void Save(Commit commit)
        {
            eventStore.Save(commit);

            if (commit.Version == 1)
            {
                statistics.IncrementInsertCount();
            }
            else
            {
                statistics.IncrementUpdateCount();
            }
        }
示例#2
0
        /// <summary>
        /// Adds a new snapshot to the snapshot store, keeping all existing snapshots.
        /// </summary>
        /// <param name="snapshot">The snapshot to append to the snapshot store.</param>
        public void Save(Snapshot snapshot)
        {
            snapshotStore.Save(snapshot);

            if (snapshot.Version == 1)
            {
                statistics.IncrementInsertCount();
            }
            else
            {
                statistics.IncrementUpdateCount();
            }
        }
示例#3
0
        /// <summary>
        /// Save the specified <paramref name="context"/> changes for the given <paramref name="saga"/>.
        /// </summary>
        /// <param name="saga">The current saga version for which the context applies.</param>
        /// <param name="context">The saga context containing the saga changes to be applied.</param>
        public Saga Save(Saga saga, SagaContext context)
        {
            var result = sagaStore.Save(saga, context);

            if (saga.Version == 1)
            {
                statistics.IncrementInsertCount();
            }
            else
            {
                if (saga.Completed)
                {
                    statistics.IncrementDeleteCount();
                }
                else
                {
                    statistics.IncrementUpdateCount();
                }
            }

            return(result);
        }