예제 #1
0
        public void Test()
        {
            var vistor = new SqlExpressionVisitor();

            //var sqlUpdateFlag = new SqlVistorFlag(SqlVistorType.Update);
            //Expression<Func<UserInfoMo, object>> funExpression =
            //    u => new {name = u.nick_name, nick_name = "s" + u.nick_name, email = u.email};
            //vistor.Visit(funExpression, sqlUpdateFlag);

            var sqlWhereFlag = new SqlVistorFlag(SqlVistorType.Where);
            Expression <Func <UserInfoMo, bool> > booExpression =
                u => (u.Id & 2) == 2 && u.Id + 2 == 3 || u.email == "test" && !u.email.Contains("ninin");

            string name = "cecee";
            var    mmm  = new UserInfoMo();

            mmm.mobile = "15922374";


            //var sqlWhereFlag = new SqlVistorFlag(SqlVistorType.Where);
            //Expression<Func<UserInfoMo, bool>> booExpression =
            //   u => u.nick_name==name&&u.mobile==mmm.mobile;

            vistor.Visit(booExpression, sqlWhereFlag);
        }
예제 #2
0
        public void SqlExpTest()
        {
            var visitor    = new SqlExpressionVisitor();
            var updateFlag = new SqlVistorFlag(SqlVistorType.Update);

            Expression <Func <object> > f = () => new { name = "test" };

            visitor.Visit(f, updateFlag);
            var paras = visitor.parameters;

            var sql = updateFlag.sql;

            Assert.IsTrue(paras.Count > 0);
        }
예제 #3
0
        public void Test()
        {
            var vistor = new SqlExpression();

            //var sqlUpdateFlag = new SqlVistorFlag(SqlVistorType.InsertOrUpdate);
            //Expression<Func<UserInfoMo, object>> funExpression =
            //    u => new {name = u.nick_name, nick_name = "s" + u.nick_name, email = u.email};
            //vistor.Visit(funExpression, sqlUpdateFlag);

            var sqlWhereFlag = new SqlVistorFlag(SqlVistorType.Where);
            Expression <Func <UserInfoMo, bool> > booExpression =
                u => u.email == "test" && 1 != 2 && false;


            vistor.Visit(booExpression, sqlWhereFlag);
        }
예제 #4
0
 static BaseMysqlRep()
 {
     m_writeConnectionString = ConfigUtil.GetConnectionString("WriteConnection");
     m_readeConnectionString = ConfigUtil.GetConnectionString("ReadeConnection");
     SqlVistorFlag.SetDbProvider(SqlVistorProvider.Mysql);
 }