/// <summary> /// Inits Event Store /// </summary> public Exercise09Projections() { databaseConnection = PostgresDbConnectionProvider.GetFreshDbConnection(); var databaseProvider = new PostgresqlDatabaseProvider(databaseConnection) { SchemaName = typeof(Exercise09Projections).Name }; var migrationsAssembly = typeof(Exercise09Projections).Assembly; var migrator = new SimpleMigrator(migrationsAssembly, databaseProvider); migrator.Load(); migrator.MigrateToLatest(); // Create Event Store eventStore = new EventStore(databaseConnection); eventStore.AddProjection(new UserDashboardProjection(databaseConnection)); // Initialize Event Store eventStore.Init(); userRepository = new Repository <User>(eventStore); orderRepository = new Repository <Order>(eventStore); }