Пример #1
0
        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);
        }
Пример #2
0
        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 MongoSnapshotStore(MongoEventStore eventStore, IMongoDatabase db, MongoEventStoreSetttings settings)
 {
     _eventStore = eventStore;
     _db         = db;
     _settings   = settings;
 }