public void Visit(ProxyStatement statement)
        {
            var selectArgs = VisitChild(statement.Test);
            VisitChild(statement.List);

            CodeMemberMethod method = new CodeMemberMethod();
            method.Name = "TestProxy";
            method.Attributes = MemberAttributes.Override | MemberAttributes.Family;
            method.ReturnType = new CodeTypeReference(typeof(bool));
            GenerateCallStatement(method.Statements, statement.Line.Line);

            ((Action)selectArgs.Tag)();

            method.Statements.Add(new CodeVariableDeclarationStatement(selectArgs.Scope.CodeDomReference,
                "resultRows",
                selectArgs.CodeExpression));

            method.Statements.Add(new CodeMethodReturnStatement(new CodeBinaryOperatorExpression(new CodePropertyReferenceExpression(new CodeTypeReferenceExpression("resultRows"), "RowCount"),
                CodeBinaryOperatorType.GreaterThan,
                new CodePrimitiveExpression(0))
                ));

            _mainType.Type.Members.Add(method);
        }
예제 #2
0
 public void Visit(ProxyStatement statement, CommonTree tree)
 {
     SetLine(statement, tree);
     Parent(tree).Children.Add(statement);
     VisitChildren(tree);
 }