public MongoStores(IMongoDatabase database, IProjectionRebuilder projectionRebuilder = null, MongoEventStreamReader eventStreamReader = null, MongoEventStoreSetttings setttings = null) { if (database == null) { throw new ArgumentNullException(nameof(database)); } _projectionRebuilder = projectionRebuilder; _eventStreamReader = eventStreamReader; if (setttings == null) { setttings = new MongoEventStoreSetttings(); } setttings.Validate(); Settings = setttings; Client = database.Client; DatabaseName = database.DatabaseNamespace.DatabaseName; _eventStore = new MongoEventStore(database, setttings) { JsonSettings = JsonSettings }; _snapshotStore = new MongoSnapshotStore(_eventStore, database, setttings); }
public void Should_use_default_settings() { var defaultSettings = new MongoEventStoreSetttings(); using (var eventStore = new MongoEventStore(_mongoClient, DatabaseName)) { eventStore.Setttings.EventsCollectionName.Should().Be(defaultSettings.EventsCollectionName); eventStore.Setttings.SnapshotsCollectionName.Should().Be(defaultSettings.SnapshotsCollectionName); } }
public MongoEventStreamReader( IMongoDatabase database, MongoEventStoreSetttings settings = null) { if (settings != null) { _settings = settings; } _database = database; }
public void Should_validate_settings(string eventCollectionName, string snapshotCollectionName) { var defaultSettings = new MongoEventStoreSetttings { EventsCollectionName = eventCollectionName, SnapshotsCollectionName = snapshotCollectionName }; Action action = () => new MongoEventStore(new MongoClient(), DatabaseName, defaultSettings); action.ShouldThrowExactly <ArgumentNullException>(); }
public void Should_use_default_settings() { var defaultSettings = new MongoEventStoreSetttings(); using (EmbeddedMongoDbServer embeddedMongoDbServer = new EmbeddedMongoDbServer()) { var eventStore = new MongoEventStore(embeddedMongoDbServer.Client, DatabaseName); eventStore.Setttings.EventsCollectionName.Should().Be(defaultSettings.EventsCollectionName); eventStore.Setttings.SnapshotsCollectionName.Should().Be(defaultSettings.SnapshotsCollectionName); } }
public void Should_use_custom_settings() { var customSettings = new MongoEventStoreSetttings { EventsCollectionName = "MyEvents", SnapshotsCollectionName = "MySnapshots" }; using (var eventStore = new MongoEventStore(_mongoClient, DatabaseName, customSettings)) { eventStore.Setttings.EventsCollectionName.Should().Be(customSettings.EventsCollectionName); eventStore.Setttings.SnapshotsCollectionName.Should().Be(customSettings.SnapshotsCollectionName); } }
public void Should_use_custom_settings() { var customSettings = new MongoEventStoreSetttings { EventsCollectionName = "MyEvents", SnapshotsCollectionName = "MySnapshots" }; using (EmbeddedMongoDbServer embeddedMongoDbServer = new EmbeddedMongoDbServer()) { var eventStore = new MongoEventStore(embeddedMongoDbServer.Client, DatabaseName, customSettings); eventStore.Setttings.EventsCollectionName.Should().Be(customSettings.EventsCollectionName); eventStore.Setttings.SnapshotsCollectionName.Should().Be(customSettings.SnapshotsCollectionName); } }
public MongoProjectionStore( MongoProjectionStrategy strategy, IMongoDatabase database, MongoEventStoreSetttings settings = null) { if (settings != null) { Settings = settings; } _strategy = strategy; _database = database; _projectionCollection = _database.GetCollection <BsonDocument>(Settings.ProjectionsCollectionName); _tempProjectionCollection = _database.GetCollection <BsonDocument>(Settings.TempProjectionsCollectionName); }
public MongoStores(MongoClient client, string database, MongoEventStoreSetttings setttings = null) { Client = client ?? throw new ArgumentNullException(nameof(client)); DatabaseName = database ?? throw new ArgumentNullException(nameof(database)); if (setttings == null) { throw new ArgumentNullException(nameof(setttings)); } setttings.Validate(); Settings = setttings; var db = Client.GetDatabase(database); _eventStore = new MongoEventStore(db, setttings) { JsonSettings = JsonSettings }; _snapshotStore = new MongoSnapshotStore(_eventStore, db, setttings); }
public void Should_validate_constructor_parameters(MongoClient mongoClient, string database, MongoEventStoreSetttings setttings) { Action action = () => new MongoEventStore(mongoClient, database, setttings); action.ShouldThrowExactly <ArgumentNullException>(); }
public MongoSnapshotStore(MongoEventStore eventStore, IMongoDatabase db, MongoEventStoreSetttings settings) { _eventStore = eventStore; _db = db; _settings = settings; }
public MongoEventStore(IMongoDatabase db, MongoEventStoreSetttings settings) { _db = db; _settings = settings; }