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); }
public InMemEventStore(IServiceProvider serviceProvider) { _aggregateRepository = new AggregateRepository(this); _projectionRepository = new ProjectionRepository(serviceProvider); _commandLog = new InMemCommandLog(); _sequences = new InMemSequenceStore(); }
public Projection(ProjectionRepository projectionRepository) { _projectionRepository = projectionRepository; }