首页
学习
活动
专区
圈层
工具
发布

ASP.NET MVC是如何运行的(3): Controller的激活

IControllerFactory通过CreateController方法根据传入的请求上下文和Controller的名称来激活相应的Controller对象。...1: public interface IControllerFactory 2: { 3: IController CreateController(RequestContext requestContext...然后通过从自己的RequestContext中提取的RouteData获得Controller的名称,最后将它连同RequestContext一起作为ContollerFactory的CreateController...作为CreateController方法输入参数的controllerName仅仅表示Controller的名称,我们需要加上Controller字符后缀作为类型名称。...在DefualtControllerFactory初始化过程中,我们通过BuildManager加载所有应用的程序集,并加载所有实现了接口IController的类型并保存起来,而在CreateController

1.1K90
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到
    领券