這個範例會顯示 AutoComplete 屬性在交易感知類別上的位置。如需 AutoComplete 屬性的詳細資訊,請參閱自動交易中的表決。
範例
<Transaction(TransactionOption.Supported)> Public Class Account
Inherits ServicedComponent
<AutoComplete()> Public Sub Debit(amount As Integer)
' Do some database work. Any exception thrown here aborts the
' transaction; otherwise, transaction commits.
End Sub
End Class
[Transaction(TransactionOption.Supported)]
public class Account : ServicedComponent {
[AutoComplete]
public void Debit(int amount) {
// Do some database work. Any exception thrown here aborts the
// transaction; otherwise, transaction commits.
}
}
編譯程式碼
這個範例需要:
- 參考 System 和 System.EnterpriseServices 命名空間。
請參閱
概念
.gif)
Copyright © 2007 by Microsoft Corporation. All rights reserved.