RouteNotMatched() public static méthode

public static RouteNotMatched ( IEnumerable matchedRestrictions, IEnumerable unmatchedRestrictions ) : MatchResult
matchedRestrictions IEnumerable
unmatchedRestrictions IEnumerable
Résultat MatchResult
Exemple #1
0
        public MatchResult MatchesRequest(HttpRequestBase request)
        {
            request.ThrowIfNull("request");

            Restrictions.MatchResult matchResult = new AndRestriction(_restrictions).MatchesRequest(request);

            return(matchResult.ResultType == Restrictions.MatchResultType.RestrictionMatched
                                ? MatchResult.RouteMatched(matchResult.MatchedRestrictions, _id.ToString())
                                : MatchResult.RouteNotMatched(matchResult.MatchedRestrictions, matchResult.UnmatchedRestrictions));
        }
Exemple #2
0
        public async Task <MatchResult> MatchesRequestAsync(HttpRequestBase request)
        {
            request.ThrowIfNull("request");

            IRestriction[] restrictions         = GetRestrictions().ToArray();
            var            matchingRestrictions = new List <IRestriction>();

            foreach (IRestriction restriction in restrictions)
            {
                if (await restriction.MatchesRequestAsync(request))
                {
                    matchingRestrictions.Add(restriction);
                }
            }

            return(restrictions.Length == matchingRestrictions.Count ? MatchResult.RouteMatched(matchingRestrictions, _id.ToString()) : MatchResult.RouteNotMatched(matchingRestrictions, restrictions.Except(matchingRestrictions)));
        }