Пример #1
0
        /// <inheritdoc />
        protected override void VisitCore(MethodCallExpression node)
        {
            switch (node.Method.Name)
            {
            case MethodCall.Any:
                using (var visitor = new NestedAnyVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            case MethodCall.All:
                using (var visitor = new NestedAllVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            case MethodCall.Contains:
                using (var visitor = new NestedContainsVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            case MethodCall.Select:
                using (var visitor = new SelectVisitor(this.visitor))
                {
                    writer.OpenBrace();

                    visitor.Startup(node);

                    writer.CloseBrace();
                }
                break;

            default:
                if (node.Type.IsValueType || node.Type == Types.String || !node.Type.IsQueryable())
                {
                    goto case MethodCall.Select;
                }

                visitor.Visit(node);

                break;
            }
        }
Пример #2
0
        /// <inheritdoc />
        protected override void VisitCore(MethodCallExpression node)
        {
            switch (node.Method.Name)
            {
            case MethodCall.Where:
            case MethodCall.TakeWhile:
                VisitCondition(node);
                break;

            case MethodCall.SkipWhile:
                writer.ReverseCondition(() => VisitCondition(node));
                break;

            case MethodCall.Any:
                using (var visitor = new NestedAnyVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            case MethodCall.All:
                using (var visitor = new NestedAllVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            case MethodCall.Contains:
                using (var visitor = new NestedContainsVisitor(this.visitor))
                {
                    visitor.Startup(node);
                }
                break;

            default:
                base.VisitCore(node);
                break;
            }
        }