在如下所示的用於解析Controller類型的GetControllerType方法中
public class ReflectedControllerFactory : IControllerFactory
{
//其他成員
protected virtual Type GetControllerType (RouteData routeData
string controllerName)
{
//根據類型名稱篩選
var types = controllerTypes
controllerName +
if (types
{
return null;
}
//通過路由對象的命名空間進行匹配
var namespaces = routeData
IEnumerable<string>;
namespacesnamespaces = namespaces ?? new string[
Type contrllerType = this
if (null != contrllerType)
{
return contrllerType;
}
//是否允許采用後備命名空間
bool useNamespaceFallback = true;
if (null != routeData
{
useNamespaceFallback =
(bool)(routeData
}
[
From:http://tw.wingwit.com/Article/program/net/201311/16083.html