private void RegisterUseCaseBus(IServiceCollection services) { var busBuilder = new UseCaseBusBuilder(services); RegisterUseCase(busBuilder); var usecaseBus = busBuilder.Build(); services.AddSingleton(usecaseBus); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSingleton <IArticleRepository, ArticleRepository>(); services.AddSingleton <IUserRepository, UserRepository>(); var busBuilder = new UseCaseBusBuilder(services); busBuilder.RegisterUseCase <ArticleCreateRequest, ArticleCreateInteractor>(); busBuilder.RegisterUseCase <ArticleGetDetailRequest, ArticleDetailGetInteractor>(); busBuilder.RegisterUseCase <ArticleGetByAutherRequest, ArticleGetByAutherInteractor>(); var bus = busBuilder.Build(); services.AddSingleton(bus); }