是.你可以做:
using (TransactionScope scope = new TransactionScope()) {
// Put the operations that you want to protect in a transaction here.
if (you_want_to_commit) {
scope.Complete();
}
// Otherwise, it'll roll back when you exit the using block.
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1850 次 |
最近记录: |