码迷,mamicode.com
首页 > 数据库 > 详细

sql sugar

时间:2017-11-02 11:28:52      阅读:666      评论:0      收藏:0      [点我收藏+]

标签:mit   type   exec   nconf   connect   xxx   color   ack   logs   

事务

using (var db = new SqlSugarClient(new ConnectionConfig()
      {
         ConnectionString = Config.xxx,
         DbType = SqlSugar.DbType.MySql
     }))
{
                try
                {
                    db.Ado.BeginTran();
                    var count = db.Updateable(flow).ExecuteCommand();
                    if (count != 1)
                        throw new Exception();
                    db.Ado.CommitTran();
                    return 1;
                }
                catch (Exception)
                {
                    db.Ado.RollbackTran();
                    return 0;
                }
}

 

sql sugar

标签:mit   type   exec   nconf   connect   xxx   color   ack   logs   

原文地址:http://www.cnblogs.com/rockywood/p/7770700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!