/// <summary> /// 绑定程序集下的所有控制器 /// </summary> /// <param name="assembly">程序集</param> private void BindController(Assembly assembly) { var controllers = assembly .GetTypes() .Where(item => item.IsAbstract == false) .Where(item => typeof(HttpController).IsAssignableFrom(item)); foreach (var controller in controllers) { var httpActions = HttpMiddleware.GetControllerHttpActions(controller); this.httpActionList.AddRange(httpActions); } }
/// <summary> /// 初始化 /// </summary> /// <param name="middleware">关联的中间件</param> /// <returns></returns> internal HttpController Init(HttpMiddleware middleware) { this.Middleware = middleware; return(this); }