Dela via


IActionSelector.SelectBestCandidate Method

Definition

Selects the best ActionDescriptor candidate from candidates for the current request associated with context.

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

Parameters

context
RouteContext

The RouteContext associated with the current request.

candidates
IReadOnlyList<ActionDescriptor>

The set of ActionDescriptor candidates.

Returns

The best ActionDescriptor candidate for the current request or null.

Exceptions

Microsoft.AspNetCore.Mvc.Internal.AmbiguousActionException

Thrown when action selection results in an ambiguity.

Thrown when action selection results in an ambiguity.

Remarks

Invokes action constraints associated with the candidates.

Used by conventional routing after calling SelectCandidates(RouteContext) to apply action constraints and disambiguate between multiple candidates.

Used by attribute routing to apply action constraints and disambiguate between multiple candidates.

Applies to