コード例 #1
0
 public MongoEventStore(IConnectionFactory connectionFactory, IMongoEventStoreConfiguration mongoEventStoreConfiguration, ISerializer serializer)
 {
     _connectionFactory            = connectionFactory;
     _mongoEventStoreConfiguration = mongoEventStoreConfiguration;
     _serializer          = serializer;
     _snapshottingEnabled = false;
     _snapshotFrequency   = 0;
 }
コード例 #2
0
        public MongoEventStore(IConnectionFactory connectionFactory, IMongoEventStoreConfiguration mongoEventStoreConfiguration, ISerializer serializer, int snapshotFrequency)
        {
            if (snapshotFrequency <= 0)
            {
                throw new ArgumentException("Snapshot frequency must be greater than 0 if set", nameof(snapshotFrequency));
            }

            _connectionFactory            = connectionFactory;
            _mongoEventStoreConfiguration = mongoEventStoreConfiguration;
            _serializer          = serializer;
            _snapshotFrequency   = snapshotFrequency;
            _snapshottingEnabled = true;
        }
コード例 #3
0
        public AggregateRootRepository(ILog logger,
                                       IMessageBus messageBus,
                                       IMongoEventStoreConfiguration configuration,
                                       IMemberService memberService)
        {
            this.logger        = logger;
            this.messageBus    = messageBus;
            this.memberService = memberService;
            var client   = new MongoClient(configuration.ConnectionString);
            var database = client.GetDatabase(configuration.DatabaseName);

            counterCollection = database.GetCollection <Counter>("Counters");

            commitsCollection = database.GetCollection <Commit>("Commits", new MongoCollectionSettings
            {
                AssignIdOnInsert = false,
                WriteConcern     = WriteConcern.Acknowledged
            });

            CreateIndexes();
        }
コード例 #4
0
 public ConnectionFactory(IMongoEventStoreConfiguration mongoEventStoreConfiguration)
 {
     _mongoEventStoreConfiguration = mongoEventStoreConfiguration;
 }