Clerkとは? わかりやすく解説

Clerk クラス

トランザクション アクションレコードログ書き込みます

名前空間: System.EnterpriseServices.CompensatingResourceManager
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

解説解説
使用例使用例

このクラス使用方法については、次のコード例参照してください

' 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 Class 'Account

// A CRM Worker
[Transaction]
public class Account : ServicedComponent
{

    // A data member for the account file name.
    private string filename;
    
    public string Filename
    {
        get
        {
            return(filename);
        }
        set
        {
            filename = value;
        }
    }


    // A boolean data member that determines whether to commit or abort
 the transaction.
    private bool commit;

    public bool AllowCommit
    {
        get
        {
            return(commit);
        }
        set
        {
            commit = value;
        }
    }



    // Debit the account, 
    public void DebitAccount (int
 ammount)
    {

        // Create a new clerk using the AccountCompensator class.
        Clerk clerk = new Clerk(typeof(AccountCompensator),
          "An account transaction compensator", CompensatorOptions.AllPhases);

        // Create a record of previous account status, and deliver it
 to the clerk.
        int balance = AccountManager.ReadAccountBalance(filename);

    Object[] record = new Object[2];
    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)
        {
            ContextUtil.SetComplete();
        }
        else
        {
            ContextUtil.SetAbort();
        }
      
    }

}
// A CRM Worker
[Transaction]
public ref class Account : public
 ServicedComponent
{

    // A data member for the account file name.
private:
    String^ filenameValue;

public:
    property String^ Filename
    {
        String^ get()
        {
            return filenameValue;
        }
        void set( String^ value )
        {
            filenameValue = value;
        }
    }

    // A boolean data member that determines whether to commit or abort
 the 
    // transaction.
private:
    bool allowCommitValue;

public:
    property bool AllowCommit
    {
        bool get()
        {
            return allowCommitValue;
        }
        void set( bool value
 )
        {
            allowCommitValue = value;
        }
    }

    // Debit the account, 
public:
    void DebitAccount(int amount)
    {

        // Create a new clerk using the AccountCompensator class.
        Clerk^ clerk = gcnew Clerk(AccountCompensator::typeid,
            "An account transaction compensator", CompensatorOptions::AllPhases);

        // Create a record of previous account status, and deliver it
 to the
        // clerk.
        int balance = ReadAccountBalance(Filename);

        array<Object^>^ record = gcnew array<Object^>(2);
        record[0] = Filename;
        record[1] = balance;

        clerk->WriteLogRecord(record);
        clerk->ForceLog();

        // Perform the transaction
        balance -= amount;

        Console::WriteLine("{0}: {1}", Filename, balance);

        WriteAccountBalance(Filename, balance);

        // Commit or abort the transaction 
        if (AllowCommit)
        {
            ContextUtil::SetComplete();
        }
        else
        {
            ContextUtil::SetAbort();
        }

    }

};
// A CRM Worker
/** @attribute Transaction()
 */
public class Account extends ServicedComponent
{
    // A data member for the account file name.
    /** @property 
     */
    private String fileName;
    
    public String get_fileName()
    {
        return fileName;
    } //get_fileName
    
    public void set_fileName(String value)
    {
        fileName = value;
    } //set_fileName

    // A boolean data member that determines whether to commit or
    // abort the transaction.
    private boolean commit;

    /** @property 
     */
    public boolean get_AllowCommit()
    {
        return commit;
    } //get_AllowCommit

    /** @property 
     */
    public void set_AllowCommit(boolean value)
    {
        commit = value;
    } //set_AllowCommit

    // Debit the account, 
    public void DebitAccount(int
 ammount)
    {
        // Create a new clerk using the AccountCompensator class.
        Clerk clerk = new Clerk(AccountCompensator.class.ToType()
,
            "An account transaction compensator",
            CompensatorOptions.AllPhases);

        // Create a record of previous account status, and deliver
        // it to the clerk.
        Console.WriteLine("filename = " + fileName);
        int balance = AccountManager.ReadAccountBalance(fileName);

        Object record[] = new Object[2];
        record.set_Item(0, fileName);
        record.set_Item(1,(Int32)balance);

        clerk.WriteLogRecord(record);
        clerk.ForceLog();

        // Perform the transaction
        balance -= ammount;
        AccountManager.WriteAccountBalance(fileName, balance);

        // Commit or abort the transaction 
        if (commit) {
            ContextUtil.SetComplete();
        }
        else {
            ContextUtil.SetAbort();
        }
    } //DebitAccount 
} //Account

対応する Compensator クラス使用方法については、次のコード例参照してください

Imports System



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 'Main 
End Class 'CrmClient

using System;

public class CrmClient
{

    public static void Main
 ()
    {

        // Create a new account object. The object is created in a COM+
 server application.
        Account account = new Account();

        // Transactionally debit the account.
        try
        {
            account.Filename = System.IO.Path.GetFullPath("JohnDoe");
            account.AllowCommit = true;
            account.DebitAccount(3);
        }
        finally
        {
            account.Dispose();
        }
          
    }

}
#using "System.EnterpriseServices.dll"

using namespace System;

[assembly: System::Reflection::AssemblyKeyFile("CrmServer.key")];

int main ()
{

    // Create a new account object. The object is created in a COM+
 server application.
    Account^ account = gcnew Account();

    // Transactionally debit the account.
    try
    {
        account->Filename = System::IO::Path::GetFullPath("JohnDoe");
        account->AllowCommit = true;
        account->DebitAccount(3);
    }
    finally
    {
        delete account;
    }

}
import System.*;

public class CrmClient
{
    public static void main(String[]
 args)
    {
        // Create a new account object. The object is created in a COM+
        // server application.
        Account account = new Account();

        // Transactionally debit the account.
        try {
            account.set_fileName(System.IO.Path.GetFullPath("JohnDoe"));
            account.set_AllowCommit(true);
            account.DebitAccount(3);
        }
        finally {
            account.Dispose();
        }
    } //main
} //CrmClient 
継承階層継承階層
System.Object
  System.EnterpriseServices.CompensatingResourceManager.Clerk
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Clerk メンバ
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk コンストラクタ (String, String, CompensatorOptions)

Clerk クラス新しインスタンス初期化します。

名前空間: System.EnterpriseServices.CompensatingResourceManager
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

Public Sub New ( _
    compensator As String, _
    description As String, _
    flags As CompensatorOptions _
)
Dim compensator As String
Dim description As String
Dim flags As CompensatorOptions

Dim instance As New Clerk(compensator,
 description, flags)
public Clerk (
    string compensator,
    string description,
    CompensatorOptions flags
)
public:
Clerk (
    String^ compensator, 
    String^ description, 
    CompensatorOptions flags
)
public Clerk (
    String compensator, 
    String description, 
    CompensatorOptions flags
)
public function Clerk (
    compensator : String, 
    description : String, 
    flags : CompensatorOptions
)

パラメータ

compensator

Compensator の名前。

description

Compensator の説明

flags

CompensatorOptions 値のビットごとの組み合わせ

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Clerk クラス
Clerk メンバ
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk コンストラクタ

Clerk クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
Clerk (String, String, CompensatorOptions) Clerk クラス新しインスタンス初期化します。
Clerk (Type, String, CompensatorOptions) Clerk クラス新しインスタンス初期化します。
参照参照

関連項目

Clerk クラス
Clerk メンバ
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk コンストラクタ (Type, String, CompensatorOptions)

Clerk クラス新しインスタンス初期化します。

名前空間: System.EnterpriseServices.CompensatingResourceManager
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

Public Sub New ( _
    compensator As Type, _
    description As String, _
    flags As CompensatorOptions _
)
Dim compensator As Type
Dim description As String
Dim flags As CompensatorOptions

Dim instance As New Clerk(compensator,
 description, flags)
public Clerk (
    Type compensator,
    string description,
    CompensatorOptions flags
)
public:
Clerk (
    Type^ compensator, 
    String^ description, 
    CompensatorOptions flags
)
public Clerk (
    Type compensator, 
    String description, 
    CompensatorOptions flags
)
public function Clerk (
    compensator : Type, 
    description : String, 
    flags : CompensatorOptions
)

パラメータ

compensator

Compensator を表す型。

description

Compensator の説明

flags

CompensatorOptions 値のビットごとの組み合わせ

使用例使用例

このコンストラクタ使用方法については、次のコード例参照してください

' Create a new clerk using the AccountCompensator class.
Dim clerk As New Clerk(GetType(AccountCompensator),
 "An account transaction compensator", CompensatorOptions.AllPhases)
// Create a new clerk using the AccountCompensator class.
Clerk clerk = new Clerk(typeof(AccountCompensator),
  "An account transaction compensator", CompensatorOptions.AllPhases);
// Create a new clerk using the AccountCompensator class.
Clerk^ clerk = gcnew Clerk(AccountCompensator::typeid,
    "An account transaction compensator", CompensatorOptions::AllPhases);
// Create a new clerk using the AccountCompensator class.
Clerk clerk = new Clerk(AccountCompensator.class.ToType()
,
    "An account transaction compensator",
    CompensatorOptions.AllPhases);
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Clerk クラス
Clerk メンバ
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ LogRecordCount ログ レコードの数を取得します
パブリック プロパティ TransactionUOW トランザクションの処理の単位 (UOW: unit of work) を表す値を取得します
参照参照

関連項目

Clerk クラス
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Clerk クラス
System.EnterpriseServices.CompensatingResourceManager 名前空間

Clerk メンバ

トランザクション アクションレコードログ書き込みます

Clerk データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ LogRecordCount ログ レコードの数を取得します
パブリック プロパティ TransactionUOW トランザクションの処理の単位 (UOW: unit of work) を表す値を取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Clerk クラス
System.EnterpriseServices.CompensatingResourceManager 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からClerkを検索した結果を表示しています。
Weblioに収録されているすべての辞書からClerkを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からClerk を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Clerk」の関連用語

Clerkのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Clerkのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS