private static void SampleQueryHandlerWithInstance() { var injector = new SimpleInjector(); var queryBus = new QueryBus(injector); queryBus.RegisterInstance(new TestQueryHandler()); var query = new TestQuery("srn"); var response = queryBus.Handle(query); Console.WriteLine(response.Message); }
private static void SampleQueryHandler() { var injector = new SimpleInjector(); injector.Register <IQueryHandler <TestQuery, TestResponse> >(() => new TestQueryHandler()); var queryBus = new QueryBus(injector); queryBus.Register <TestQuery, IQueryHandler <TestQuery, TestResponse> >(); var query = new TestQuery("srn"); var response = queryBus.Handle(query); Console.WriteLine(response.Message); }