事务
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