本文整理汇总了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