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

                }

 

posted @ 2016-06-03 13:50  shiningrise  阅读(272)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css