internal static bool IsValidSortOpKeyType(TypeUsage typeUsage)
 {
     if (!TypeSemantics.IsRowType(typeUsage))
     {
         return(TypeSemantics.IsOrderComparable(typeUsage));
     }
     foreach (EdmMember property in ((RowType)typeUsage.EdmType).Properties)
     {
         if (!TypeHelpers.IsValidSortOpKeyType(property.TypeUsage))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #2
0
        //
        // Type Semantics
        //

        /// <summary>
        ///     Determines whether a given typeUsage is valid as OrderBy sort key
        /// </summary>
        /// <param name="typeUsage"> </param>
        /// <returns> </returns>
        internal static bool IsValidSortOpKeyType(TypeUsage typeUsage)
        {
            if (TypeSemantics.IsRowType(typeUsage))
            {
                var rowType = (RowType)typeUsage.EdmType;
                foreach (var property in rowType.Properties)
                {
                    if (!IsValidSortOpKeyType(property.TypeUsage))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                return(TypeSemantics.IsOrderComparable(typeUsage));
            }
        }