.net coreAPI 事务回滚

1、上代码:

using (TransactionScope scope = new TransactionScope())
                {
                    using (connection)
                    {
                        connection.Open();
                        ...........
                        return new ApiResponse("插入成功!");
                    }
                    scope.Complete();
                }

2、参考:https://www.cnblogs.com/yilezhu/p/10170712.html

你可能感兴趣的:(c#)