Example #1
0
        void AppendPossibleMatches(IReadOnlyList <ActionDescriptor> matches, RouteContext context, ActionSelectionResult result)
        {
            Contract.Requires(matches != null);
            Contract.Requires(context != null);
            Contract.Requires(result != null);

            if (matches.Count == 0)
            {
                return;
            }

            var routeData       = new RouteData(context.RouteData);
            var matchingActions = new MatchingActionSequence(matches, routeData);

            result.AddMatches(matchingActions);
            result.TrySetBestMatch(matchingActions.BestMatch);
        }
Example #2
0
        ActionDescriptor SelectActionWithApiVersionPolicyApplied(IReadOnlyList <ActionDescriptor> matches, ActionSelectionResult result)
        {
            Contract.Requires(matches != null);
            Contract.Requires(result != null);

            if (matches.Count != 1)
            {
                return(null);
            }

            var match = matches[0];

            if (match.VersionPolicyIsApplied() && !result.HasMatchesInPreviousIterations)
            {
                return(match);
            }

            return(null);
        }