방법: 트랜잭션 인식 클래스에 AutoComplete 특성 설정

이 예제에서는 트랜잭션 인식 클래스에 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 네임스페이스에 대한 참조

참고 항목

개념

자동 트랜잭션에서의 응답

Footer image

Copyright © 2007 by Microsoft Corporation. All rights reserved.