Example #1
0
 /// <summary>
 /// Creates an instance of the <see cref="InMemoryEventStore"/> class.
 /// </summary>
 /// <param name="settings">Settings</param>
 public InMemoryEventStore(InMemoryEventStoreSettings settings)
 {
     _serializer         = settings.EventSerializer;
     _streamNameResolver = settings.StreamNameResolver;
     _clock           = settings.Clock;
     _metadataFactory = settings.MetadataFactory;
 }
Example #2
0
 public RecordedEvent(StoredEvent @event, IJsonEventSerializer serializer, TIdentity id, long eventNumber)
 {
     _event      = @event;
     _serializer = serializer;
     EventNumber = eventNumber;
     Id          = id;
 }
Example #3
0
 public EventStore(
     IEventStoreConnection connection,
     IJsonEventSerializer serializer,
     IStreamNameResolver streamNameResolver
     )
 {
     _connection         = connection;
     _serializer         = serializer;
     _streamNameResolver = streamNameResolver;
 }
        /// <summary>
        /// Creates a new instance of the <see cref="VerifiableEventStore"/> class.
        /// </summary>
        /// <param name="settings">Settings</param>
        public VerifiableEventStore(VerifiableEventStoreSettings settings)
        {
            _serializer = settings.EventSerializer;

            var inMemorySettings = new InMemoryEventStoreSettings(settings.EventSerializer);

            inMemorySettings.StreamNameResolver = settings.StreamNameResolver;
            inMemorySettings.MetadataFactory    = settings.MetadataFactory;

            _store = new InMemoryEventStore(inMemorySettings);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MongoEventStore"/> class.
        /// </summary>
        /// <param name="settings">The settings to configure behaviour of the instance.</param>
        public MongoEventStore(MongoEventStoreSettings settings)
        {
            _database   = settings.Database;
            _collection = settings.Collection;

            _events             = settings.Database.GetCollection <RecordedEventDocument>(settings.Collection);
            _serializer         = settings.EventSerializer;
            _logger             = settings.Logger;
            _clock              = settings.Clock;
            _transactionOptions = settings.TransactionOptions;
            _streamNameResolver = settings.StreamNameResolver;
            _metadataFactory    = settings.MetadataFactory;
        }
Example #6
0
 protected SubscriptionService(
     StreamStoreBase streamStoreClient,
     string subscriptionName,
     ICheckpointStore checkpointStore,
     IJsonEventSerializer eventSerializer,
     IEnumerable <IEventHandler> projections,
     ILoggerFactory?loggerFactory = null,
     ProjectionGapMeasure?measure = null
     )
 {
     StreamStoreClient = streamStoreClient;
     _checkpointStore  = checkpointStore;
     _eventSerializer  = eventSerializer;
     _subscriptionName = subscriptionName;
     _measure          = measure;
     _projections      = projections.Where(x => x.SubscriptionGroup == subscriptionName).ToArray();
     _log      = loggerFactory?.CreateLogger($"StreamSubscription-{subscriptionName}");
     _debugLog = _log?.IsEnabled(LogLevel.Debug) == true ? _log.LogDebug : null;
 }
 protected AllStreamSubscriptionService(
     StreamStoreBase streamStreamStoreClient,
     string subscriptionName,
     ICheckpointStore checkpointStore,
     IJsonEventSerializer eventSerializer,
     IEnumerable <IEventHandler> projections,
     ILoggerFactory?loggerFactory = null,
     ProjectionGapMeasure?measure = null
     ) : base(
         streamStreamStoreClient,
         subscriptionName,
         checkpointStore,
         eventSerializer,
         projections,
         loggerFactory,
         measure
         )
 {
 }
Example #8
0
 /// <inheritdoc />
 public byte[] Data(IJsonEventSerializer serializer) =>
 serializer.Serialize(_data);
Example #9
0
 /// <inheritdoc/>
 public byte[]? MetadataFor <T>(Guid id, EventType <T> type, T data, IJsonEventSerializer serializer)
 {
     return(null);
 }
 /// <summary>
 /// Creates an instance of the <see cref="MongoEventStoreSettings"/> class.
 /// </summary>
 /// <param name="database">The MongoDB database accessor.</param>
 /// <param name="collection">The name of the MongoDB collection containing event streams.</param>
 /// <param name="eventSerializer">The serializer to use when serializing events.</param>
 public MongoEventStoreSettings(IMongoDatabase database, string collection, IJsonEventSerializer eventSerializer)
 {
     Database        = database;
     Collection      = collection;
     EventSerializer = eventSerializer;
 }
 /// <inheritdoc />
 public byte[]? Metadata(IMetadataFactory factory, IJsonEventSerializer serializer) =>
 factory.MetadataFor(Id, _type, _data, serializer);
 public byte[]? MetadataFor <T>(Guid id, EventType <T> type, T data, IJsonEventSerializer serializer)
 {
     return(serializer.Serialize(new { Username }));
 }
 /// <summary>
 /// Creates an instance of the <see cref="VerifiableEventStoreSettings"/> class.
 /// </summary>
 /// <param name="eventSerializer">Serializer to use when serializing events.</param>
 public VerifiableEventStoreSettings(IJsonEventSerializer eventSerializer)
 {
     EventSerializer = eventSerializer;
 }
 /// <summary>
 /// Creates an instance of the <see cref="InMemoryEventStoreSettings"/> class.
 /// </summary>
 /// <param name="eventSerializer">Serializer to use when serializing events.</param>
 public InMemoryEventStoreSettings(IJsonEventSerializer eventSerializer)
 {
     EventSerializer = eventSerializer;
 }
Example #15
0
 /// <inheritdoc />
 public byte[]? Metadata(IMetadataFactory factory, IJsonEventSerializer serializer) =>
 _metadata == null ? null : serializer.Serialize(_metadata);
Example #16
0
 public RecordedEvent(RecordedEventDocument document, IJsonEventSerializer serializer, TIdentity id)
 {
     Id          = id;
     _document   = document;
     _serializer = serializer;
 }
Example #17
0
 public JsonAggregateStore(IJsonEventStore eventStore, IJsonEventSerializer serializer)
 {
     _eventStore = eventStore;
     _serializer = serializer;
 }