예제 #1
0
        public void OneOutputOneInput()
        {
            //arrange
            const string sql =
                @"SELECT Name:string FROM Users WHERE Id= @id:int";

            //act
            var input = new ANTLRStringStream(sql);
            var lexer = new TypeSqlLexer(input);
            var tokenStream = new CommonTokenStream(lexer);
            var parser = new TypeSqlParser(tokenStream);

            var parseResult = parser.typesql();
        }
예제 #2
0
        public void Template()
        {
            //arrange
            const string sql =
                @"SELECT UserId:int FROM Users";

            //act
            var input = new ANTLRStringStream(sql);
            var lexer = new TypeSqlLexer(input);
            var tokenStream = new CommonTokenStream(lexer);
            var parser = new TypeSqlParser(tokenStream);
            var parseResult = parser.typesql();

            var templateGroup = new StringTemplateGroup(
                new StreamReader(new FileStream(@"..\..\..\TypeSql\Parsing\DapperDao.stg", FileMode.Open)),
                typeof (TemplateLexer));

            var dapperDaoTransform = new DaoTransform(new CommonTreeNodeStream(parseResult.Tree))
                {
                    TemplateGroup = templateGroup
                };

            //var result = dapperDaoTransform.sql("UserIds").Template.ToString();
        }
예제 #3
0
        public void TwoOutputs()
        {
            //arrange
            const string sql =
                @"SELECT UserId:int, UserName:string FROM Users";

            //act
            var input = new ANTLRStringStream(sql);
            var lexer = new TypeSqlLexer(input);
            var tokenStream = new CommonTokenStream(lexer);
            var parser = new TypeSqlParser(tokenStream);

            var parseResult = parser.typesql();
        }