Clerk クラス
アセンブリ: 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.EnterpriseServices.CompensatingResourceManager.Clerk
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Clerk コンストラクタ (String, String, CompensatorOptions)
アセンブリ: 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)
- compensator
Compensator の名前。
- description
Compensator の説明。
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Clerk コンストラクタ
オーバーロードの一覧
名前 | 説明 |
---|---|
Clerk (String, String, CompensatorOptions) | Clerk クラスの新しいインスタンスを初期化します。 |
Clerk (Type, String, CompensatorOptions) | Clerk クラスの新しいインスタンスを初期化します。 |
Clerk コンストラクタ (Type, String, CompensatorOptions)
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文
Dim compensator As Type Dim description As String Dim flags As CompensatorOptions Dim instance As New Clerk(compensator, description, flags)
- compensator
Compensator を表す型。
- description
Compensator の説明。
このコンストラクタの使用方法については、次のコード例を参照してください。
' 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);
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Clerk プロパティ
Clerk メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) | |
ForceLog | すべてのログ レコードをディスクに強制保存します。 | |
ForceTransactionToAbort | トランザクションで、即時中止呼び出しを実行します。 | |
ForgetLogRecord | このインターフェイスのインスタンスによって書き込まれた最終ログ レコードを配信しません。 | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) | |
WriteLogRecord | 非構造化ログ レコードをログに書き込みます。 |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
Clerk メンバ
トランザクション アクションのレコードをログに書き込みます。
Clerk データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ
パブリック メソッド
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) | |
ForceLog | すべてのログ レコードをディスクに強制保存します。 | |
ForceTransactionToAbort | トランザクションで、即時中止呼び出しを実行します。 | |
ForgetLogRecord | このインターフェイスのインスタンスによって書き込まれた最終ログ レコードを配信しません。 | |
GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 (Object から継承されます。) | |
WriteLogRecord | 非構造化ログ レコードをログに書き込みます。 |
名前 | 説明 | |
---|---|---|
Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) | |
MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
Weblioに収録されているすべての辞書からclerkを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からclerk を検索
- clerkのページへのリンク