本文整理匯總了VB.NET中System.EnterpriseServices.CompensatingResourceManager.Clerk類的典型用法代碼示例。如果您正苦於以下問題:VB.NET Clerk類的具體用法?VB.NET Clerk怎麽用?VB.NET Clerk使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Clerk類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Account
' A CRM Worker
<Transaction()> _
Public Class Account
Inherits ServicedComponent
' A data member for the account file name.
Private filename As String
Public Property Filenam() As String
Get
Return Filename
End Get
Set(ByVal value As String)
filename = Value
End Set
End Property
' A boolean data member that determines whether to commit or abort the transaction.
Private commit As Boolean
Public Property AllowCommit() As Boolean
Get
Return commit
End Get
Set
commit = value
End Set
End Property
' Debit the account,
Public Sub DebitAccount(ByVal ammount As Integer)
' Create a new clerk using the AccountCompensator class.
Dim clerk As New Clerk(GetType(AccountCompensator), "An account transaction compensator", CompensatorOptions.AllPhases)
' Create a record of previous account status, and deliver it to the clerk.
Dim balance As Integer = AccountManager.ReadAccountBalance(Filenam)
Dim record(1) As [Object]
record(0) = filename
record(1) = balance
clerk.WriteLogRecord(record)
clerk.ForceLog()
' Perform the transaction
balance -= ammount
AccountManager.WriteAccountBalance(filename, balance)
' Commit or abort the transaction
If commit Then
ContextUtil.SetComplete()
Else
ContextUtil.SetAbort()
End If
End Sub
End Class
示例2: Main
Public Class CrmClient
Public Shared Sub Main()
' Create a new account object. The object is created in a COM+ server application.
Dim account As New Account()
' Transactionally debit the account.
Try
account.Filenam = System.IO.Path.GetFullPath("JohnDoe")
account.AllowCommit = True
account.DebitAccount(3)
Finally
account.Dispose()
End Try
End Sub
End Class