コード例 #1
0
        public static IQueryable Where(this IQueryable source, string predicate, Type[] otherRequiredTypes)
        {
            Ensure.ArgumentNotNull(source, "source");
            Ensure.ArgumentNotNull(predicate, "predicate");

            var parser     = new CSharpScriptingExpressionParser();
            var expression = parser.ParseLambdaAsync(source.ElementType, typeof(bool), predicate, otherRequiredTypes).Result;

            return(source.Provider.CreateQuery(
                       Expression.Call(
                           typeof(Queryable),
                           "Where",
                           new Type[] { source.ElementType },
                           source.Expression,
                           Expression.Quote(expression))));
        }
コード例 #2
0
        public static IQueryable ThenByDescending(this IQueryable source, string ordering, Type orderedPropertyType, Type[] otherRequiredTypes)
        {
            Ensure.ArgumentNotNull(source, "source");
            Ensure.ArgumentNotNull(ordering, "ordering");
            Ensure.ArgumentNotNull(orderedPropertyType, "orderedPropertyType");

            var parser     = new CSharpScriptingExpressionParser();
            var expression = parser.ParseLambdaAsync(source.ElementType, orderedPropertyType, ordering, otherRequiredTypes).Result;

            return(source.Provider.CreateQuery(
                       Expression.Call(
                           typeof(Queryable),
                           "ThenByDescending",
                           new Type[] { source.ElementType, orderedPropertyType },
                           source.Expression,
                           Expression.Quote(expression))));
        }