Exemplo n.º 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);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  BigMo转化为Mo
        ///    主要防止直接返回BigMo附带用户密码,来源渠道等字段
        /// </summary>
        /// <param name="io"></param>
        /// <returns></returns>
        public static UserInfoMo ConvertToMo(this UserInfoBigMo io)
        {
            var userInfo = new UserInfoMo
            {
                email       = io.email,
                nick_name   = io.nick_name,
                mobile      = io.mobile,
                Id          = io.Id,
                create_time = io.create_time,

                status = io.status
            };

            return(userInfo);
        }
Exemplo n.º 3
0
        public void UserTest()
        {
            var mo = new UserInfoMo
            {
                email  = "*****@*****.**",
                mobile = "1111111111"
            };

            var rep = new UserInfoRep();

            var res = rep.Add(mo);

            mo.id     = res.Id;
            mo.email  = "*****@*****.**";
            mo.mobile = "222222222222";
        }
Exemplo n.º 4
0
        public void UserTest()
        {
            var mo = new UserInfoMo
            {
                email  = "*****@*****.**",
                mobile = "1111111111"
            };

            var rep = new UserInfoRep();

            var res = rep.Insert(mo);

            mo.Id     = res.Id;
            mo.email  = "*****@*****.**";
            mo.mobile = "222222222222";

            rep.UpdateAll(mo);                                    //  全量更新测试

            rep.Update(mo, m => new { m.email }, m => m.Id == 1); //  部分更新
            rep.DeleteSoft(mo);                                   //  软删除
            rep.Get(mo, m => m.Id == 16);                         //  查询
        }