Esempio n. 1
0
        private IPersistence CreatePersistence(Type owner, TKey key, HandleEvent?applyEvent)
        {
            Guard.NotNull(key);

            var snapshotStore = GetSnapshotStore <None>();

            return(new Persistence <TKey>(key, owner, eventStore, eventEnricher, eventDataFormatter, snapshotStore, streamNameResolver, applyEvent));
        }
Esempio n. 2
0
        internal BatchPersistence(DomainId ownerKey, BatchContext <T> context, long version, IReadOnlyList <Envelope <IEvent> > @events,
                                  HandleEvent?applyEvent)
        {
            this.ownerKey   = ownerKey;
            this.context    = context;
            this.events     = events;
            this.applyEvent = applyEvent;

            Version = version;
        }
Esempio n. 3
0
 public Persistence(TKey ownerKey, Type ownerType,
                    IEventStore eventStore,
                    IEventDataFormatter eventDataFormatter,
                    ISnapshotStore <None, TKey> snapshotStore,
                    IStreamNameResolver streamNameResolver,
                    HandleEvent?applyEvent)
     : base(ownerKey, ownerType, eventStore, eventDataFormatter, snapshotStore, streamNameResolver,
            PersistenceMode.EventSourcing, null, applyEvent)
 {
 }
Esempio n. 4
0
 public Persistence(TKey ownerKey, Type ownerType,
                    IEventStore eventStore,
                    IEventEnricher <TKey> eventEnricher,
                    IEventDataFormatter eventDataFormatter,
                    ISnapshotStore <TSnapshot, TKey> snapshotStore,
                    IStreamNameResolver streamNameResolver,
                    PersistenceMode persistenceMode,
                    HandleSnapshot <TSnapshot>?applyState,
                    HandleEvent?applyEvent)
 {
     this.ownerKey           = ownerKey;
     this.ownerType          = ownerType;
     this.applyState         = applyState;
     this.applyEvent         = applyEvent;
     this.eventStore         = eventStore;
     this.eventEnricher      = eventEnricher;
     this.eventDataFormatter = eventDataFormatter;
     this.persistenceMode    = persistenceMode;
     this.snapshotStore      = snapshotStore;
     this.streamNameResolver = streamNameResolver;
 }
Esempio n. 5
0
        private IPersistence <T> CreatePersistence(Type owner, DomainId key, PersistenceMode mode, HandleSnapshot <T>?applySnapshot, HandleEvent?applyEvent)
        {
            Guard.NotNull(key, nameof(key));

            return(new Persistence <T>(key, owner,
                                       snapshotStore,
                                       eventStore,
                                       eventDataFormatter,
                                       streamNameResolver,
                                       mode,
                                       applySnapshot,
                                       applyEvent));
        }
Esempio n. 6
0
 public IPersistence <T> WithSnapshotsAndEventSourcing(Type owner, DomainId key, HandleSnapshot <T>?applySnapshot, HandleEvent?applyEvent)
 {
     return(CreatePersistence(owner, key, PersistenceMode.SnapshotsAndEventSourcing, applySnapshot, applyEvent));
 }
Esempio n. 7
0
 public IPersistence <T> WithEventSourcing(Type owner, DomainId key, HandleEvent?applyEvent)
 {
     return(CreatePersistence(owner, key, PersistenceMode.EventSourcing, null, applyEvent));
 }
Esempio n. 8
0
        private IPersistence <TState> CreatePersistence <TState>(Type owner, TKey key, PersistenceMode mode, HandleSnapshot <TState>?applySnapshot, HandleEvent?applyEvent)
        {
            Guard.NotNull(key);

            var snapshotStore = GetSnapshotStore <TState>();

            return(new Persistence <TState, TKey>(key, owner, eventStore, eventEnricher, eventDataFormatter, snapshotStore, streamNameResolver, mode, applySnapshot, applyEvent));
        }
Esempio n. 9
0
 public IPersistence <TState> WithSnapshotsAndEventSourcing <TState>(Type owner, TKey key, HandleSnapshot <TState>?applySnapshot, HandleEvent?applyEvent)
 {
     return(CreatePersistence(owner, key, PersistenceMode.SnapshotsAndEventSourcing, applySnapshot, applyEvent));
 }
Esempio n. 10
0
 public IPersistence WithEventSourcing(Type owner, TKey key, HandleEvent?applyEvent)
 {
     return(CreatePersistence(owner, key, applyEvent));
 }