如何在asp.net-core 2.0中进行交易? [英] How to make a transaction in asp.net-core 2.0?

查看:71
本文介绍了如何在asp.net-core 2.0中进行交易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新一些值,但万一失败,我需要回滚.如何在asp.net-core-2.0中做到这一点?

I want to update some values but in case one fails I need to rollback. How can I do this in asp.net-core-2.0?

我尚未找到任何答案.这是因为尚不支持它吗?在那种情况下,有什么选择?

I have not found any answers yet. Is this because it is not yet supported? In that case what are some alternatives?

推荐答案

是的,使用System.Transactions.TransactionScope,自.Net Core 2.0及更高版本开始提供.检查一下:

Yes man, using System.Transactions.TransactionScope, available since .Net Core 2.0 and above. check this:

在ASP.NET中使用System.Transactions: https://msdn.microsoft.com/en-us/ms229977

Using System.Transactions in ASP.NET: https://msdn.microsoft.com/en-us/ms229977

使用交易范围实施隐式交易: https://msdn.microsoft.com/en-us/ms172152

Implementing an Implicit Transaction using Transaction Scope: https://msdn.microsoft.com/en-us/ms172152

这篇关于如何在asp.net-core 2.0中进行交易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆