首页 > 移动平台 > 详细

dapper 参数不定时用这种方法动态参数

时间:2017-08-17 09:38:11      阅读:282      评论:0      收藏:0      [点我收藏+]
       string where = null;
            var p = new DynamicParameters();
            if (classId != null)
            {
                where = " and classId=:classId ";
                p.Add("classId", classId);
            }
            if (key != null)
            {
                where = " and (name like :key or description like :key) ";
                key = string.Format("%{0}%", key);
                p.Add("key", key);
            }

 

dapper 参数不定时用这种方法动态参数

原文:http://www.cnblogs.com/ruidong/p/7379696.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!