예제 #1
0
        // Baselining as Safe for Mix demo so that interface can be transparent. Marking this
        // critical (which was the original annotation when porting to silverlight) would violate
        // fxcop security rules if the interface isn't also critical. However, transparent code
        // can't access this anyway for Mix since we're not exposing AsQueryable().
        // [....]: the above assertion no longer holds. Now making AsQueryable() public again
        // the security fallout of which will need to be re-examined.
        object IQueryProvider.Execute(Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            var newExpression = MoqqerExpressionRewriter.RewriteLinqCall(expression);

            return(EnumerableExecutor.Create(newExpression).ExecuteBoxed());
        }
예제 #2
0
        // see above
        TS IQueryProvider.Execute <TS>(Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }
            if (!typeof(TS).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException(nameof(expression));
            }

            var newExpression = MoqqerExpressionRewriter.RewriteLinqCall(expression);

            return(new EnumerableExecutor <TS>(newExpression).Execute());
        }
예제 #3
0
        IQueryable <TS> IQueryProvider.CreateQuery <TS>(Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }
            if (!typeof(IQueryable <TS>).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException(nameof(expression));
            }

            var res = MoqqerExpressionRewriter.RewriteLinqCall(expression);

            return(new EnumerableMoqqerQuery <TS>(res));
        }
예제 #4
0
        IQueryable IQueryProvider.CreateQuery(Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            var iqType = TypeHelper.FindGenericType(typeof(IQueryable <>), expression.Type);

            if (iqType == null)
            {
                throw new ArgumentOutOfRangeException(nameof(expression));
            }

            var res = MoqqerExpressionRewriter.RewriteLinqCall(expression);

            return(Create(iqType.GetGenericArguments()[0], res));
        }