public void Start() { Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host)))); _container = new WindsorContainer(); _container.RegisterDataAccessCore(); _container.RegisterDataAccess("Shuttle.Sentinel"); _container.RegisterDataAccess("Shuttle.Recall.SqlServer"); _container.Register(Component.For <IDatabaseContextCache>().ImplementedBy <ThreadStaticDatabaseContextCache>()); _container.Register(Component.For <IEventStore>().ImplementedBy <EventStore>()); _container.Register(Component.For <IKeyStore>().ImplementedBy <KeyStore>()); _container.Register(Component.For <ISerializer>().ImplementedBy <DefaultSerializer>()); _container.Register(Component.For <IEventStoreQueryFactory>().ImplementedBy <EventStoreQueryFactory>()); _container.Register(Component.For <IKeyStoreQueryFactory>().ImplementedBy <KeyStoreQueryFactory>()); _container.Register(Component.For <IProjectionService>().ImplementedBy <ProjectionService>()); _container.Register(Component.For <IProjectionConfiguration>().Instance(ProjectionSection.Configuration())); _container.RegisterConfiguration(SentinelSection.Configuration()); _container.Register(Component.For <object>().ImplementedBy <UserProjectionHandler>().Named("UserProjectionHandler")); _processor = EventProcessor.Create(c => { c.ProjectionService(_container.Resolve <IProjectionService>()); }); _processor.AddEventProjection(new EventProjection("User").AddEventHandler(_container.Resolve <object>("UserProjectionHandler"))); _processor.Start(); }
public void TestEventCRUD() { IEvent e = CreateEvent(EventType.Wedding); var ep = new EventProcessor(e); var save = ep.Create().Result; Assert.IsTrue(save.Data != null && save.Data.Id != Guid.Empty, "Event save failed."); var one = ep.FetchById().Result; Assert.IsTrue(one.Data != null, "Event fetch failed."); var delete = ep.Delete().Result; one = ep.FetchById().Result; Assert.IsTrue(one.Data == null, "Event delete failed."); var vp = new VendorProcessor(e.Arrangements[0].Vendor.Id); var d = vp.Delete().Result; var o = vp.FetchById().Result; Assert.IsTrue(o.Data == null, "Vendor delete failed."); var uHelper = new UserProcessor(e.Arrangements[0].Vendor.Id); var uOne = uHelper.FetchById().Result; Assert.IsTrue(uOne.Data == null, "User not deleted from vendor delete."); }
public void ExerciseEventStore() { var container = new WindsorComponentContainer(new WindsorContainer()); EventStore.Register(container); using (container.Resolve <IDatabaseContextFactory>().Create(EventStoreConnectionStringName)) { RecallFixture.ExerciseEventStore(EventStore.Create(container), EventProcessor.Create(container)); } }
public async Task <HttpResponseMessage> Create(EventRequest req) { IEvent e = EventBase.GetEventFromType(req.Type); if (e != null) { req.CopyRequestToEvent(e); var ep = new EventProcessor(e); var res = await ep.Create(); if (res != null && res.Success) { return(new HttpResponseMessage() { Content = new StringContent(JsonConvert.SerializeObject(new { Id = res.Data.Id.ToString() })) }); } } return(new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)); }