/// <summary> /// http://support.nservicebus.com/customer/portal/articles/859362-using-ravendb-in-nservicebus-%E2%80%93-connecting /// </summary> public void Init() { SetLoggingLibrary.Log4Net(XmlConfigurator.Configure); var eventPersistenceFactory = EventPersistenceFactoryConfiguration.CreateFactory(); var container = new Container(x => { x.For <IEventPublisher>().Use <NServiceBusEventPublisher>(); x.For <IEventMappings>() .LifecycleIs(new SingletonLifecycle()) .Use(() => new NServiceBusDomainEventMappingFactory().CreateMappingCollection()); x.For <IEventPersistence>() .LifecycleIs(new SingletonLifecycle()) .Use(new EventPersistenceWithLogging(eventPersistenceFactory.CreateEventPersistence())); x.For <IEventStore>().Use <EventStore>(); x.For <IDomainRepository>().Use <DomainRepository>(); x.For <ISendEmails>().Use <BlackHoleEmailSender>(); x.For <IGeneratePassword>().Use <RandomNumberPasswordGenerator>(); x.For <IHash>().Use <SHA512Hasher>(); //Doing this as I cannot see a route to constructor injection with //Sagas that work with the NServiceBus Test framework x.FillAllPropertiesOfType <IDomainRepository>(); }); Configure.With() .Log4Net() .StructureMapBuilder(container) .EnablePerformanceCounters(); LogManager.GetLogger(this.GetType()).Info("Initialized"); }
public void ShouldReturnInstanceOfEventStoreFactory() { var factory = EventPersistenceFactoryConfiguration.CreateFactory(); Assert.That(factory, Is.TypeOf <MongoContactEventPersistenceFactory>()); }