private EFEventStoreOptions GetOptions(
     BufferInfo bufferInfo = null,
     SnapshotEventsArchiveBehavior behavior = SnapshotEventsArchiveBehavior.Disabled)
 {
     return(new EFEventStoreOptions(
                o => o.UseSqlite("Filename=Events_Test_Base.db"),
                _snapshotProviderMock.Object,
                bufferInfo,
                behavior,
                o => o.UseSqlite("Filename=Events_Test_Archive_Base.db")));
 }
Exemple #2
0
 private EFEventStoreOptions GetOptions(
     BufferInfo bufferInfo = null,
     SnapshotEventsArchiveBehavior behavior = SnapshotEventsArchiveBehavior.Disabled,
     bool shouldPersisteNonAggregateEvt     = true)
 {
     return(new EFEventStoreOptions(
                o => o.UseSqlite("Filename=Events_Test_Base.db"),
                _snapshotProviderMock.Object,
                bufferInfo,
                behavior,
                o => o.UseSqlite("Filename=Events_Test_Archive_Base.db"),
                shouldPersisteNonAggregateEvt));
 }
 /// <summary>
 /// Creates a new options class with a defined snapshot behavior provider and servers urls.
 /// </summary>
 /// <param name="snapshotBehaviorProvider">Snapshot behavior provider.</param>
 /// <param name="snapshotEventsArchiveBehavior">Behavior for archive events after creating snapshot.</param>
 /// <param name="serversUrls">Collection of urls to use as server.</param>
 public MongoEventStoreOptions(ISnapshotBehaviorProvider snapshotBehaviorProvider,
                               SnapshotEventsArchiveBehavior snapshotEventsArchiveBehavior = SnapshotEventsArchiveBehavior.StoreToNewDatabase,
                               params string[] serversUrls)
 {
     if (serversUrls == null)
     {
         throw new ArgumentNullException(nameof(serversUrls));
     }
     if (serversUrls.Length == 0)
     {
         throw new ArgumentException("MongoDbEventStoreBootstrapperConfiguration.ctor() : At least one url should be provided, for main server.", nameof(serversUrls));
     }
     ServerUrls = serversUrls.AsEnumerable();
     SnapshotBehaviorProvider      = snapshotBehaviorProvider;
     SnapshotEventsArchiveBehavior = snapshotEventsArchiveBehavior;
 }
 /// <summary>
 /// Creates a new options class with a defined snapshot behavior provider and servers urls.
 /// </summary>
 /// <param name="snapshotBehaviorProvider">Snapshot behavior provider.</param>
 /// <param name="snapshotEventsArchiveBehavior">Behavior for archive events after creating snapshot.</param>
 /// <param name="serversUrls">Collection of urls to use as server.</param>
 public MongoEventStoreOptions(string userName, string password,
                               ISnapshotBehaviorProvider snapshotBehaviorProvider,
                               SnapshotEventsArchiveBehavior snapshotEventsArchiveBehavior = SnapshotEventsArchiveBehavior.StoreToNewDatabase,
                               params string[] serversUrls)
     : this(snapshotBehaviorProvider, snapshotEventsArchiveBehavior, serversUrls)
 {
     if (string.IsNullOrWhiteSpace(userName))
     {
         throw new ArgumentException("MongoDbEventStoreBootstrapperConfiguration.ctor() : Username should be provided", nameof(userName));
     }
     if (string.IsNullOrWhiteSpace(password))
     {
         throw new ArgumentException("MongoDbEventStoreBootstrapperConfiguration.ctor() : Password should be provided", nameof(password));
     }
     Username = userName;
     Password = password;
 }
Exemple #5
0
        public EFEventStore(EFEventStoreOptions options, ILoggerFactory loggerFactory = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _dbContextOptions         = options.DbContextOptions;
            _logger                   = (loggerFactory ?? new LoggerFactory()).CreateLogger <EFEventStore>();
            _snapshotBehaviorProvider = options.SnapshotBehaviorProvider;

            _bufferInfo      = options.BufferInfo;
            _archiveBehavior = options.ArchiveBehavior;
            _archiveBehaviorDbContextOptions = options.ArchiveDbContextOptions;

            if (_bufferInfo != null)
            {
                s_SlidingTimer  = new Timer(TreatBufferEvents, null, Timeout.Infinite, Timeout.Infinite);
                s_AbsoluteTimer = new Timer(TreatBufferEvents, null, Timeout.Infinite, Timeout.Infinite);
            }
        }
Exemple #6
0
 public MongoDbEventStore(ISnapshotBehaviorProvider snapshotBehaviorProvider = null,
                          SnapshotEventsArchiveBehavior archiveBehavior      = SnapshotEventsArchiveBehavior.StoreToNewTable)
 {
     _snapshotBehaviorProvider = snapshotBehaviorProvider;
     _archiveBehavior          = archiveBehavior;
 }
 public EventStoreDbContext(DbContextOptions <EventStoreDbContext> contextOptions, SnapshotEventsArchiveBehavior behavior)
     : base(contextOptions)
 {
     _behavior = behavior;
 }
 public EventStoreDbContext(DbContextOptions <EventStoreDbContext> contextOptions)
     : base(contextOptions)
 {
     _behavior = SnapshotEventsArchiveBehavior.StoreToNewTable;
 }