public static void InitAddMvcBuilder(MvcOptions options, IAddMvcBuilder builder) { if (options.FindControllersByReflection) { //Search controllers. builder.Controllers = ControllersTypesSearch.FindAllControllers(); } }
public static void AddControllersServices(IAddMvcBuilder builder) { var serv = builder.ServiceCollection; serv.AddSingleton <IControllersFactory, ControllersFactory>(); serv.AddSingleton <IControllerInspector, ControllerInspector>(); serv.AddSingleton <IControllerActionPreparer, ControllerActionPreparer>(); serv.AddSingleton <IControllersFactory, ControllersFactory>(); //Register controllers. foreach (var controllerType in builder.Controllers) { serv.AddTransient(controllerType); } }
static void AddServises_RequiredBuilder(ServiceCollectionWrapper serviceCollectionWrapper, IAddMvcBuilder addMvcBuilder) { var serv = serviceCollectionWrapper.Services; foreach (var controllerType in addMvcBuilder.Controllers) { serv.AddTransient(controllerType); } }