TransactionAttribute クラス
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文
<ComVisibleAttribute(False)> _ <AttributeUsageAttribute(AttributeTargets.Class, Inherited:=True)> _ Public NotInheritable Class TransactionAttribute Inherits Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)] public sealed class TransactionAttribute : Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets::Class, Inherited=true)] public ref class TransactionAttribute sealed : public Attribute
トランザクション タイプがこの属性で指定されている場合は、COM+ カタログでトランザクション タイプを変更できません。COM+ カタログでトランザクション タイプが変更された場合、コンポーネントでこの属性を使用して同じトランザクション タイプを指定する必要があります。
TransactionAttribute を使用して ServicedComponent をトランザクションとしてマークする方法のコード例を次に示します。
<Transaction()> _ Public Class TransactionalComponent Inherits ServicedComponent Public Sub TransactionalMethod(ByVal data As String) ContextUtil.DeactivateOnReturn = True ContextUtil.MyTransactionVote = TransactionVote.Abort ' Do work with data. Return if any errors occur. ' Vote to commit. If any errors occur, this code will not execute. ContextUtil.MyTransactionVote = TransactionVote.Commit End Sub 'TransactionalMethod End Class 'TransactionalComponent
[Transaction] public class TransactionalComponent : ServicedComponent { public void TransactionalMethod (string data) { ContextUtil.DeactivateOnReturn = true; ContextUtil.MyTransactionVote = TransactionVote.Abort; // Do work with data. Return if any errors occur. // Vote to commit. If any errors occur, this code will not execute. ContextUtil.MyTransactionVote = TransactionVote.Commit; } }
[assembly:System::Reflection::AssemblyKeyFile("Transaction.snk")]; [Transaction] public ref class TransactionalComponent: public ServicedComponent { public: void TransactionalMethod( String^ data ) { ContextUtil::DeactivateOnReturn = true; ContextUtil::MyTransactionVote = TransactionVote::Abort; // do work with data ContextUtil::MyTransactionVote = TransactionVote::Commit; } };
/** @attribute Transaction() */ public class TransactionalComponent extends ServicedComponent { public void TransactionalMethod(String data) { ContextUtil.set_DeactivateOnReturn(true); ContextUtil.set_MyTransactionVote(TransactionVote.Abort); // Do work with data. Return if any errors occur. // Vote to commit. If any errors occur, this code will not execute. ContextUtil.set_MyTransactionVote(TransactionVote.Commit); } //TransactionalMethod } //TransactionalComponent
System.Attribute
System.EnterpriseServices.TransactionAttribute
プラットフォーム
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Weblioに収録されているすべての辞書からTransactionAttribute クラスを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からTransactionAttribute クラス を検索
- TransactionAttribute クラスのページへのリンク