public class Global : System
{
protected void Application_Start(object sender
{
//其他操作
ControllerBuilder
new DefaultControllerFactory())
}
}
作為默認ControllerFactory的DefaultControllerFactory類型定義如下
public class DefaultControllerFactory : IControllerFactory
{
private static List<Type> controllerTypes = new List<Type>()
static DefaultControllerFactory()
{
foreach (Assembly assembly in BuildManager
{
foreach (Type type in assembly
type => typeof(IController)
{
controllerTypes
}
}
}
public IController CreateController(RequestContext requestContext
string controllerName)
{
string typeName = controllerName +
Type controllerType = controllerTypes
c => string
if (null == controllerType)
{
return null;
}
return (IController)Activator
}
}
返回目錄
編輯推薦
ASP
Microsoft
Java程序性能優化
Visual C++音頻/視頻技術開發與實戰
[
From:http://tw.wingwit.com/Article/program/net/201311/16107.html