internal override MethodInfo SelectActionMethod(Type[] parameterTypes) { if (!_metadata.Match(parameterTypes)) { throw new Exception("Can not find a matching method for the provided parameters!"); } return(_metadata.GetCallableMethod(parameterTypes)); }
internal override MethodInfo SelectActionMethod(Type[] parameterTypes) { MethodMetadata target = null; foreach (var metadata in _metadataList) { if (!metadata.Match(parameterTypes)) { continue; } if (!metadata.IsGeneric) { return(metadata.MethodInfo); } target = metadata; } if (target != null) { // 代码运行到此,如果能找到,找到的一定是泛型方法重载,而且是包含参数的泛型方法重载 return(target.GetCallableMethod(parameterTypes)); } throw new Exception("Can not find an appropriate override method with the parameters provided for the controller!"); }