Exemplo n.º 1
0
        public PostgresEventStore(IServiceProvider serviceProvider, string connectionString, string databaseSchemaName, bool cleanAll = false)
        {
            _aggregateRepository  = new AggregateRepository(this);
            _projectionRepository = new ProjectionRepository(serviceProvider);

            var options = new StoreOptions();

            options.Connection(connectionString);
            options.Projections.Add(new Projection(_projectionRepository));

            // Serialize enums as strings
            var serializer = new Marten.Services.JsonNetSerializer();

            serializer.EnumStorage = Weasel.Core.EnumStorage.AsString;
            options.Serializer(serializer);

            // Can be overridden
            options.AutoCreateSchemaObjects = Weasel.Postgresql.AutoCreate.All;
            options.DatabaseSchemaName      = databaseSchemaName;

            _store = new DocumentStore(options);

            if (cleanAll)
            {
                _store.Advanced.Clean.CompletelyRemoveAll();
            }

            _commandLog = new PostgresCommandLog(_store);

            _sequences = new PostgresSequenceStore(connectionString, databaseSchemaName);
        }
Exemplo n.º 2
0
 public InMemEventStore(IServiceProvider serviceProvider)
 {
     _aggregateRepository  = new AggregateRepository(this);
     _projectionRepository = new ProjectionRepository(serviceProvider);
     _commandLog           = new InMemCommandLog();
     _sequences            = new InMemSequenceStore();
 }
Exemplo n.º 3
0
 public PropertyHelper()
 {
     _sequenceValues = new Sequences();
 }