Пример #1
0
        public static async Task Project <T>(this Projector <T> projector, string streamName, ISnapshotStore snapshotManager)
            where T : class, new()
        {
            var p = await projector.ProjectAsync(streamName);

            await snapshotManager.Apply <T>(typeof(T).Name, snap => p);
        }
Пример #2
0
 public static GameModule Initialize(
     IAdvancedEventStore store,
     ISnapshotStore snapshotStore,
     Func <IEvent[], Task> pub)
 => new Configuration <GameModule>((c, p, q, s) => new GameModule(c, p, q, s))
 .Commands(
     Commands.Validate <ICommand>(),
     Commands.GuaranteeCorrelation <ICommand>(),
     cmd => store.ExecuteAsync <GameState>(cmd, state =>
                                           Game.Handle(cmd, state),
                                           async events =>
 {
     await snapshotStore.Apply <GamesView>(events.Select(e => e.Event).Apply);
     await pub(events);
 }, snapshotStore, state => state.Version, (newVersion, state) => state.Pipe(x => x with {
Пример #3
0
 public static Task Apply <T>(this ISnapshotStore snapshotStore, Func <T, T> f)
     where T : class, new()
 => snapshotStore.Apply <T>(typeof(T).Name, f);