public async Task Send_message_to_test_consumer() { // add migrations by calling // dotnet ef migrations add --context auditdbcontext --output-dir Migrations\\Audit audit_init DbContextOptionsBuilder <AuditDbContext> optionsBuilder = new DbContextOptionsBuilder <AuditDbContext>(). UseSqlServer(LocalDbConnectionStringProvider.GetLocalDbConnectionString(), m => { var executingAssembly = typeof(ContextFactory).GetTypeInfo().Assembly; m.MigrationsAssembly(executingAssembly.GetName().Name); m.MigrationsHistoryTable("__AuditEFMigrationHistoryAudit"); }); _store = new EntityFrameworkAuditStore(optionsBuilder.Options, "EfCoreAudit"); using (var dbContext = _store.AuditContext) { await dbContext.Database.MigrateAsync(); await dbContext.Database.ExecuteSqlRawAsync("TRUNCATE TABLE EfCoreAudit"); } _harness = new InMemoryTestHarness(); _harness.OnConnectObservers += bus => { bus.ConnectSendAuditObservers(_store); bus.ConnectConsumeAuditObserver(_store); }; _consumer = _harness.Consumer <TestConsumer>(); await _harness.Start(); await _harness.InputQueueSendEndpoint.Send(new A()); }
public SimpleSagaDbContext CreateDbContext(string[] args) { var dbContextOptionsBuilder = new DbContextOptionsBuilder <SimpleSagaDbContext>(); dbContextOptionsBuilder.UseSqlServer(LocalDbConnectionStringProvider.GetLocalDbConnectionString(), m => { var executingAssembly = typeof(ContextFactory).GetTypeInfo().Assembly; m.MigrationsAssembly(executingAssembly.GetName().Name); }); return(new SimpleSagaDbContext(dbContextOptionsBuilder.Options)); }
public AuditDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <AuditDbContext>(). UseSqlServer(LocalDbConnectionStringProvider.GetLocalDbConnectionString(), m => { var executingAssembly = typeof(ContextFactory).GetTypeInfo().Assembly; m.MigrationsAssembly(executingAssembly.GetName().Name); m.MigrationsHistoryTable("__AuditEFMigrationHistoryAudit"); }); return(new AuditDbContext(optionsBuilder.Options, "EfCoreAudit")); }