protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>(bool enableBatchDispatch = false) { var tableName = typeof(TViewInstance).Name; if (typeof(TViewInstance) == typeof(ViewRoot)) { MsSqlTestHelper.DropTable("ViewChilds"); } if (typeof(TViewInstance) == typeof(GeneratedIds)) { MsSqlTestHelper.DropTable("StoredIds"); } MsSqlTestHelper.DropTable(tableName); MsSqlTestHelper.DropTable(tableName + "_Position"); var viewManager = new EntityFrameworkViewManager <TViewInstance>(_connectionString) { BatchDispatchEnabled = enableBatchDispatch }; _createdEntityFrameworkViewManagers.Add(viewManager); return(viewManager); }
protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>(bool enableBatchDispatch = false) { MsSqlTestHelper.DropTable(typeof(TViewInstance).Name + "_HybridDb"); MsSqlTestHelper.DropTable(typeof(TViewInstance).Name + "_Documents"); MsSqlTestHelper.DropTable(typeof(TViewInstance).Name + "_ViewPositions"); MsSqlTestHelper.DropTable(typeof(TViewInstance).Name + "_Views"); var documentStore = DocumentStore.ForTesting( TableMode.UseRealTables, MsSqlTestHelper.ConnectionString, x => { x.UseTableNamePrefix(typeof(TViewInstance).Name + "_"); x.Document <ViewPosition>().Key(v => v.Id); x.Document <TViewInstance>("Views").Key(v => v.Id); }); documentStore.Initialize(); RegisterDisposable(documentStore); return(new HybridDbViewManager <TViewInstance>(documentStore) { BatchDispatchEnabled = enableBatchDispatch }); }
public EntityFrameworkViewManagerFactory() { MsSqlTestHelper.EnsureTestDatabaseExists(); MsSqlTestHelper.DropTable("__MigrationHistory"); _connectionString = MsSqlTestHelper.ConnectionString; }
protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>() { var tableName = typeof(TViewInstance).Name; MsSqlTestHelper.DropTable(tableName); var viewManager = new MsSqlViewManager <TViewInstance>(_connectionString, tableName); return(viewManager); }
public MsSqlEventStoreFactory() { MsSqlTestHelper.EnsureTestDatabaseExists(); var connectionString = MsSqlTestHelper.ConnectionString; MsSqlTestHelper.DropTable("events"); _eventStore = new MsSqlEventStore(connectionString, "events"); _eventStore.DropEvents(); }
protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>(bool enableBatchDispatch = false) { var tableName = typeof(TViewInstance).Name; MsSqlTestHelper.DropTable(tableName); var viewManager = new MsSqlViewManager <TViewInstance>(_connectionString, tableName) { BatchDispatchEnabled = enableBatchDispatch }; return(viewManager); }
public MsSqlEventStoreFactory() { var configuration = Configuration.Get(); //var helper = new MsSqlTestHelper(configuration); MsSqlTestHelper.EnsureTestDatabaseExists(); var connectionString = MsSqlTestHelper.ConnectionString; MsSqlTestHelper.DropTable("events"); _eventStore = new MsSqlEventStore(configuration, MsSqlTestHelper.TestDbName, "events"); _eventStore.DropEvents(); }
protected override void DoSetUp() { CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Info); MsSqlTestHelper.EnsureTestDatabaseExists(); MsSqlTestHelper.DropTable("__MigrationHistory"); MsSqlTestHelper.DropTable("SomeParent_Position"); MsSqlTestHelper.DropTable("AnotherChilds"); MsSqlTestHelper.DropTable("SomeChilds"); MsSqlTestHelper.DropTable("SomeParent"); _viewManager = new EntityFrameworkViewManager <SomeParent>(MsSqlTestHelper.ConnectionString); _context = TestContext.Create() .AddViewManager(_viewManager); RegisterForDisposal(_context); }
public void TheSnippet() { MsSqlTestHelper.DropTable("events"); MsSqlTestHelper.DropTable("counters"); var viewManager = new MsSqlViewManager <CounterView>(MsSqlTestHelper.ConnectionString, "counters", automaticallyCreateSchema: true); var processor = CreateCommandProcessor(config => config .EventStore(e => e.UseSqlServer(MsSqlTestHelper.ConnectionString, "events", automaticallyCreateSchema: true)) .EventDispatcher(e => e.UseViewManagerEventDispatcher(viewManager)) ); RegisterForDisposal(processor); processor.ProcessCommand(new IncrementCounter("id", 1)); processor.ProcessCommand(new IncrementCounter("id", 2)); processor.ProcessCommand(new IncrementCounter("id", 3)); processor.ProcessCommand(new IncrementCounter("id", 5)); processor.ProcessCommand(new IncrementCounter("id", 8)); }
protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>(bool enableBatchDispatch = false) { var tableName = typeof(TViewInstance).Name + "_HybridDb"; MsSqlTestHelper.DropTable(tableName); var documentStore = DocumentStore.ForTesting( TableMode.UseRealTables, MsSqlTestHelper.ConnectionString, new LambdaHybridDbConfigurator(x => { x.Document <ViewPosition>().With("Id", v => v.Id); x.Document <TViewInstance>(tableName).With("Id", v => v.Id); })); RegisterDisposable(documentStore); return(new HybridDbViewManager <TViewInstance>(documentStore) { BatchDispatchEnabled = enableBatchDispatch }); }
IEventStore GetEventStore(EventStoreOption eventStoreOption) { switch (eventStoreOption) { case EventStoreOption.InMemory: return(new InMemoryEventStore()); case EventStoreOption.MongoDb: return(new MongoDbEventStore(GetMongoDb(), "Events")); case EventStoreOption.SqlServer: MsSqlTestHelper.EnsureTestDatabaseExists(); MsSqlTestHelper.DropTable("Events"); return(new MsSqlEventStore(Configuration.Get(), MsSqlTestHelper.ConnectionString, "Events")); case EventStoreOption.Postgres: PostgreSqlTestHelper.DropTable("Events"); return(new PostgreSqlEventStore(Configuration.Get(), PostgreSqlTestHelper.PostgreSqlConnectionString, "Events")); default: throw new ArgumentOutOfRangeException("eventStoreOption", "Unknown event store option"); } }
public HybridDbViewManagerFactory() { MsSqlTestHelper.EnsureTestDatabaseExists(); MsSqlTestHelper.DropTable("HybridDb"); MsSqlTestHelper.DropTable("ViewPosition"); }