交易范围及使用 [英] Transaction Scope and using

查看:67
本文介绍了交易范围及使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用

 使用(Transactionscope范围= ……)
{
} 



如何将事务作用域用于多个对象?

我可以将范围对象转移到对象吗?

格式化了代码,并提高了英语水平. > BulbulAhmed写道:

如何对多个对象使用事务作用域?


using块中执行所需的任何操作.


BulbulAhmed写道:

我可以将范围对象转移到对象吗?



只要您在交易范围内(即在using子句中)进行操作即可.尽管您始终可以在没有using子句的情况下实例化TransactionScope.

这应该很有用:

http://msdn.microsoft.com/en-us/library/ms172152.aspx [ ^ ]


If I use

using(Transactionscope scope = new......)
{
}



how can I use transaction scope for multiple objects?

Can I transfer scope object to object?

[Edit Keith Barrow] Formatted code and improved English a little while I was at it.

解决方案

BulbulAhmed wrote:

how can I use transaction scope for multiple objects?


Do whatever you need to do inside the using block.


BulbulAhmed wrote:

Can I transfer scope object to object?



As long as you do it within the scope of the transaction (i.e. in the using clause). Though you can always instantiate the TransactionScope without the using clause.

This should be useful:

http://msdn.microsoft.com/en-us/library/ms172152.aspx[^]


这篇关于交易范围及使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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