EF事务
var db = this.UnitOfWork as CodeFirstDbContext; using (var tan = db.Database.BeginTransaction()) { try { CoinDetailContract.Refund(order.CustomerId, 204, order.Coin, order.Id); string out_refund_no = WeChatPayContract.Refund(order, 204, order.MailCoin, order.Id, refund_id); tan.Commit(); return out_refund_no; } catch (Exception) { tan.Rollback(); throw; } }