TransactionVote Enum
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the values allowed for transaction outcome voting.
public enum class TransactionVote
C#
[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public enum TransactionVote
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Serializable>]
type TransactionVote =
Public Enum TransactionVote
- Inheritance
- Attributes
Name | Value | Description |
---|---|---|
Commit | 0 | Commits the current transaction. |
Abort | 1 | Aborts the current transaction. |
The following code example demonstrates the use of this enumeration.
[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;
}
};
C#
[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;
}
}
<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
End Class
This enumeration is used by the ContextUtil class.
Produkto | Mga Bersyon |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Makipagtulungan sa amin sa GitHub
Ang pinagmulan para sa content na ito ay mahahanap sa GitHub, kung saan maaari ka ring lumikha at sumuri ng mga isyu at mga pull request. Para sa higit pang impormasyon, tingnan ang aming gabay sa contributor.
Feedback sa .NET
Ang .NET ay isang open source na project. Pumili ng link para magbibigay ng feedback: