すべてのHTTPメソッドを受け入れます。属性なしだから、
private static List<MethodInfo> RunSelectionFilters(ControllerContext
controllerContext, List<MethodInfo> methodInfos)
{
// remove all methods which are opting out of this request
// to opt out, at least one attribute defined on the method must
// return false
List<MethodInfo> matchesWithSelectionAttributes = new List<MethodInfo>();
List<MethodInfo> matchesWithoutSelectionAttributes = new List<MethodInfo>();
foreach (MethodInfo methodInfo in methodInfos)
{
ActionMethodSelectorAttribute[] attrs =
(ActionMethodSelectorAttribute[])methodInfo.
GetCustomAttributes(typeof(ActionMethodSelectorAttribute),
true /* inherit */);
if (attrs.Length == 0)
{
matchesWithoutSelectionAttributes.Add(methodInfo);
}
else
if (attrs.All(attr => attr.IsValidForRequest(controllerContext,
methodInfo)))
{
matchesWithSelectionAttributes.Add(methodInfo);
}
}
// if a matching action method had a selection attribute,
// consider it more specific than a matching action method
// without a selection attribute
return (matchesWithSelectionAttributes.Count > 0) ?
matchesWithSelectionAttributes :
matchesWithoutSelectionAttributes;
}
マッチングアクションメソッドは、明示的な属性では良いがある場合は、アクションメソッドになります。
ActionMethodSelector.csからわずかフォーマットされた断片(ASP.NET MVCソースがhereをダウンロードすることができます)を見利用される。
私の推測は(PUT、DELETEも含めて)どんなものであろう。私はあなたが実験で見つけることができると思います - AcceptVerbs属性なしで簡単なテストアクションを行い、それに対するいくつかの異なるリクエストを投げ、何が起こるかを見てください。私は答えを知りたいです:-) –