sql sugar

时间:2017-11-02 10:19:36   收藏:0   阅读:384

事务

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;
                }
}

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!