Beispiel #1
0
        private static bool CheckLastTwoSegments <TSegment1, TSegment2>(this ODataUri uri, Func <TSegment1, bool> check1, Func <TSegment2, bool> check2)
            where TSegment1 : ODataUriSegment
            where TSegment2 : ODataUriSegment
        {
            if (uri.Segments.Count < 2)
            {
                return(false);
            }

            if (!uri.CheckLastSegment(check2))
            {
                return(false);
            }

            return(uri.Segments[uri.Segments.Count - 2].CheckSegment(check1));
        }
Beispiel #2
0
 /// <summary>
 /// Returns whether or not the uri refers to a function call
 /// </summary>
 /// <param name="uri">The uri to extend</param>
 /// <returns>whether or not the uri refers to a function call</returns>
 public static bool IsFunction(this ODataUri uri)
 {
     return(uri.CheckLastSegment <FunctionSegment>(f => f.Function.IsFunction()) ||
            uri.CheckLastTwoSegments <FunctionSegment, ParametersExpressionSegment>(f => f.Function.IsFunction(), p => true));
 }
Beispiel #3
0
 /// <summary>
 /// Returns whether or not the uri refers to a procedure call
 /// </summary>
 /// <param name="uri">The uri to extend</param>
 /// <returns>whether or not the uri refers to a procedure call</returns>
 public static bool IsAction(this ODataUri uri)
 {
     return(uri.CheckLastSegment <FunctionSegment>(f => f.Function.IsAction()));
 }