public GIVEN_store_and_bus_with_an_aggregate_in_memory() { DbConfiguration.SetConfiguration(new TransientFaultHandlingDbConfiguration()); this.serializer = CreateSerializer(); this.dbName = typeof(EventStoreFixture).Name; var connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.messageSender = new MessageSender(connectionFactory, this.dbName, "Bus.Events"); this.connectionString = connectionFactory.CreateConnection(this.dbName).ConnectionString; using (var context = new EventStoreDbContext(this.connectionString)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } MessagingDbInitializer.CreateDatabaseObjects(this.connectionString, "Bus"); this.eventBus = new EventBus(this.messageSender, this.serializer); this.commandBus = new CommandBus(this.messageSender, this.serializer, new LocalDateTime()); this.sut = new EventStore <FakeItemsAggregate>(this.eventBus, this.commandBus, this.serializer, () => (new EventStoreDbContext(this.connectionString)), new ConsoleTracer(), new LocalDateTime(), new InMemorySnapshotProvider("Test", new LocalDateTime()), new StandardMetadataProvider()); }
public given_sender() { this.connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.sender = new MessageSender(this.connectionFactory, "TestSqlMessaging", "Test.Commands"); MessagingDbInitializer.CreateDatabaseObjects(this.connectionFactory.CreateConnection("TestSqlMessaging").ConnectionString, "Test", true); }
public GIVEN_store_and_bus_with_an_aggregate_in_memory() { DbConfiguration.SetConfiguration(new TransientFaultHandlingDbConfiguration()); this.serializer = CreateSerializer(); this.dbName = typeof(EventStoreFixture).Name; var connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.connectionString = connectionFactory.CreateConnection(this.dbName).ConnectionString; // ********************************* // EN FECOPROD: this.connectionString = string.Format("server=(local);Database={0};User Id=sa;pwd =123456", this.dbName); // BORRAR CUANDO SEA NECESARIO //*********************************** using (var context = new EventStoreDbContext(this.connectionString)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } this.bus = new InMemoryBus(); MessagingDbInitializer.CreateDatabaseObjects(this.connectionString, "Bus"); }
public given_sender() { // TODO: DEPRECATED - The default connection factory should be set in the config file or using the DbConfiguration class this.connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.sender = new MessageSender(this.connectionFactory, "TestSqlMessaging", "Test.Commands"); MessagingDbInitializer.CreateDatabaseObjects(this.connectionFactory.CreateConnection("TestSqlMessaging").ConnectionString, "Test", true); }
public GIVEN_sender() { this.connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.sender = new MessageSender(this.connectionFactory, this.dbName, "Test.Commands"); this.connectionString = this.connectionFactory.CreateConnection(this.dbName).ConnectionString; MessagingDbInitializer.CreateDatabaseObjects(this.connectionString, "Test", true); }
public given_sender_and_receiver() { connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; sender = new MessageSender(connectionFactory, "TestSqlMessaging", "Test.Commands"); receiver = new TestableMessageReceiver(connectionFactory); MessagingDbInitializer.CreateDatabaseObjects(connectionFactory.CreateConnection("TestSqlMessaging").ConnectionString, "Test", true); }
public GIVEN_sender_and_receiver() { this.connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.sender = new MessageSender(this.connectionFactory, "TestSqlMessaging", "Test.Events"); this.receiver = new TestableMessageReceiver(this.connectionFactory); this.connectionString = this.connectionFactory.CreateConnection(this.dbName).ConnectionString; MessagingDbInitializer.CreateDatabaseObjects(this.connectionString, "Test", true); }
private static void Main(string[] args) { var connectionString = ConfigurationManager.AppSettings["defaultConnection"]; if (args.Length > 0) { connectionString = args[0]; } // Use ConferenceContext as entry point for dropping and recreating DB using (var context = new ConferenceContext()) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } Database.SetInitializer <EventStoreDbContext>(null); Database.SetInitializer <MessageLogDbContext>(null); Database.SetInitializer <BlobStorageDbContext>(null); Database.SetInitializer <ConferenceRegistrationDbContext>(null); Database.SetInitializer <RegistrationProcessManagerDbContext>(null); Database.SetInitializer <PaymentsDbContext>(null); DbContext[] contexts = { new EventStoreDbContext(connectionString), new MessageLogDbContext(connectionString), new BlobStorageDbContext(connectionString), new PaymentsDbContext(connectionString), new RegistrationProcessManagerDbContext(connectionString), new ConferenceRegistrationDbContext(connectionString) }; foreach (var context in contexts) { var adapter = (IObjectContextAdapter)context; var script = adapter.ObjectContext.CreateDatabaseScript(); context.Database.ExecuteSqlCommand(script); context.Dispose(); } using (var context = new ConferenceRegistrationDbContext(connectionString)) { ConferenceRegistrationDbContextInitializer.CreateIndexes(context); } using (var context = new RegistrationProcessManagerDbContext(connectionString)) { RegistrationProcessManagerDbContextInitializer.CreateIndexes(context); } using (var context = new PaymentsDbContext(connectionString)) { PaymentsReadDbContextInitializer.CreateViews(context); } MessagingDbInitializer.CreateDatabaseObjects(connectionString, "SqlBus"); }
public void Setup() { this._connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this._sender = new MessageSender(this._connectionFactory, "TestSqlMessaging", "Test.Commands"); this._receiver = new TestableMessageReceiver(this._connectionFactory); MessagingDbInitializer.CreateDatabaseObjects( this._connectionFactory.CreateConnection("TestSqlMessaging").ConnectionString, "Test", true); }
public GIVEN_store_and_event_bus_with_a_Saga_in_memory() { DbConfiguration.SetConfiguration(new TransientFaultHandlingDbConfiguration()); this.serializer = CreateSerializer(); this.dbName = typeof(EventStoreFixture).Name; var connectionFactory = System.Data.Entity.Database.DefaultConnectionFactory; this.commandSender = new MessageSender(connectionFactory, this.dbName, "Bus.Commands"); this.eventSender = new MessageSender(connectionFactory, this.dbName, "Bus.Events"); this.connectionString = connectionFactory.CreateConnection(this.dbName).ConnectionString; /** FECOPROD **/ this.connectionString = string.Format("server=(local);Database={0};User Id=sa;pwd =123456", dbName); using (var context = new EventStoreDbContext(this.connectionString)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } MessagingDbInitializer.CreateDatabaseObjects(this.connectionString, "Bus"); this.eventBus = new EventBus(this.eventSender, this.serializer); this.commandBus = new CommandBus(this.commandSender, this.serializer, new LocalDateTime()); this.sut = new EventStore <FakeItemsSaga>(this.eventBus, this.commandBus, this.serializer, () => (new EventStoreDbContext(this.connectionString)), new ConsoleTracer(), new LocalDateTime(), new InMemorySnapshotProvider("Test", new LocalDateTime()), new StandardMetadataProvider()); }