首页 > 数据库技术 > 详细

sql sugar

时间:2017-11-02 10:19:36      阅读:384      评论:0      收藏:0      [点我收藏+]

事务

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

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

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