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); }
public void Rebuild() { var complexEventProcessor = new SynchronousEventDispatcher(this.tracer); var serializer = new JsonTextSerializer(); using (var context = domainRegistry.ContextFactory.Invoke()) { foreach (var registrationAction in domainRegistry.RegistrationList) { registrationAction(context, complexEventProcessor, this.tracer); } Func <EventStoreDbContext> eventStoreContextFactory = () => new EventStoreDbContext(domainRegistry.Config.EventStoreConnectionString); var perfCounter = new ReadModelRebuilderPerfCounter(this.tracer, this.domainRegistry.Config.SystemTime); var engine = new ReadModelRebuilderEngine <T>(eventStoreContextFactory, serializer, complexEventProcessor, context, perfCounter); engine.Rebuild(); this.PerformanceCounter = perfCounter; } }