IActionSelector.SelectBestCandidate 方法

定义

candidates 中为与 context关联的当前请求选择最佳ActionDescriptor候选项。

public:
 Microsoft::AspNetCore::Mvc::Abstractions::ActionDescriptor ^ SelectBestCandidate(Microsoft::AspNetCore::Routing::RouteContext ^ context, System::Collections::Generic::IReadOnlyList<Microsoft::AspNetCore::Mvc::Abstractions::ActionDescriptor ^> ^ candidates);
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor SelectBestCandidate (Microsoft.AspNetCore.Routing.RouteContext context, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor> candidates);
public Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor? SelectBestCandidate (Microsoft.AspNetCore.Routing.RouteContext context, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor> candidates);
abstract member SelectBestCandidate : Microsoft.AspNetCore.Routing.RouteContext * System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor> -> Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor
Public Function SelectBestCandidate (context As RouteContext, candidates As IReadOnlyList(Of ActionDescriptor)) As ActionDescriptor

参数

context
RouteContext

RouteContext 当前请求关联的 。

candidates
IReadOnlyList<ActionDescriptor>

候选项集 ActionDescriptor

返回

当前请求或 null的最佳ActionDescriptor候选项。

例外

Microsoft.AspNetCore.Mvc.Internal.AmbiguousActionException

当操作选择导致歧义时引发。

当操作选择导致歧义时引发。

注解

调用与候选项关联的操作约束。

在调用 SelectCandidates(RouteContext) 后由传统路由使用,以应用操作约束并在多个候选项之间消除歧义。

由属性路由用于应用操作约束并在多个候选项之间消除歧义。

适用于