Пример #1
0
        private void RegistrarUnicoBoundedContext(SimpleInventarioDbContext context, IEventHandlerRegistry rebuildEventProcessor, ITracer tracer)
        {
            var readModelGeneratorEngine = new ReadModelGeneratorEngine <SimpleInventarioDbContext>(context, tracer);
            var readModelGenerator       = new SimpleInventarioReadModelGenerator(readModelGeneratorEngine);

            rebuildEventProcessor.Register(readModelGenerator);
        }
Пример #2
0
 public GIVEN_read_model_rebuilder()
 {
     this.rebuildContext  = this.readModelContextFactory.Invoke();
     this.generatorEngine = new ReadModelGeneratorEngine <ItemReadModelDbContext>(rebuildContext, this.tracer);
     this.itemGenerator   = new ItemReadModelGenerator(this.generatorEngine);
     this.eventDispatcher = new SynchronousEventDispatcher(this.tracer);
     this.eventDispatcher.Register(itemGenerator);
     this.sut = new ReadModelRebuilderEngine <ItemReadModelDbContext>(this.eventStoreContextFactory, this.serializer, this.eventDispatcher, rebuildContext, new Mock <IRebuilderPerfCounter>().Object);
 }
Пример #3
0
        public GIVEN_generator_and_read_model()
        {
            DbConfiguration.SetConfiguration(new TransientFaultHandlingDbConfiguration());
            var dbName = "ReadModelingFixture";

            this.connectionString = System.Data.Entity.Database.DefaultConnectionFactory.CreateConnection(dbName).ConnectionString;
            this.contextFactory   = () => new SimpleInventarioDbContext(this.connectionString);

            var generator = new ReadModelGeneratorEngine <SimpleInventarioDbContext>(
                this.contextFactory, new ConsoleTracer());

            this.sut = new SimpleInventarioReadModelGenerator(generator);

            using (var context = this.contextFactory.Invoke())
            {
                if (context.Database.Exists())
                {
                    context.Database.Delete();
                }

                context.Database.Create();
            }
        }