PreparingEnlistment.ForceRollback Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Indica che deve essere eseguito il rollback della transazione.
ForceRollback() |
Indica che deve essere eseguito il rollback della transazione. |
ForceRollback(Exception) |
Indica che deve essere eseguito il rollback della transazione. |
- Origine:
- PreparingEnlistment.cs
- Origine:
- PreparingEnlistment.cs
- Origine:
- PreparingEnlistment.cs
Indica che deve essere eseguito il rollback della transazione.
public:
void ForceRollback();
public void ForceRollback ();
member this.ForceRollback : unit -> unit
Public Sub ForceRollback ()
Esempio
class myEnlistmentClass : IEnlistmentNotification
{
public void Prepare(PreparingEnlistment preparingEnlistment)
{
Console.WriteLine("Prepare notification received");
//Perform transactional work
//If work finished correctly, reply prepared
preparingEnlistment.Prepared();
// otherwise, do a ForceRollback
preparingEnlistment.ForceRollback();
}
public void Commit(Enlistment enlistment)
{
Console.WriteLine("Commit notification received");
//Do any work necessary when commit notification is received
//Declare done on the enlistment
enlistment.Done();
}
public void Rollback(Enlistment enlistment)
{
Console.WriteLine("Rollback notification received");
//Do any work necessary when rollback notification is received
//Declare done on the enlistment
enlistment.Done();
}
public void InDoubt(Enlistment enlistment)
{
Console.WriteLine("In doubt notification received");
//Do any work necessary when indout notification is received
//Declare done on the enlistment
enlistment.Done();
}
}
Public Class EnlistmentClass
Implements IEnlistmentNotification
Public Sub Prepare(ByVal myPreparingEnlistment As PreparingEnlistment) Implements System.Transactions.IEnlistmentNotification.Prepare
Console.WriteLine("Prepare notification received")
'Perform transactional work
'If work finished correctly, reply with prepared
myPreparingEnlistment.Prepared()
End Sub
Public Sub Commit(ByVal myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.Commit
Console.WriteLine("Commit notification received")
'Do any work necessary when commit notification is received
'Declare done on the enlistment
myEnlistment.Done()
End Sub
Public Sub Rollback(ByVal myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.Rollback
Console.WriteLine("Rollback notification received")
'Do any work necessary when rollback notification is received
'Declare done on the enlistment
myEnlistment.Done()
End Sub
Public Sub InDoubt(ByVal myEnlistment As Enlistment) Implements System.Transactions.IEnlistmentNotification.InDoubt
Console.WriteLine("In doubt notification received")
'Do any work necessary when indout notification is received
'Declare done on the enlistment
myEnlistment.Done()
End Sub
End Class
Commenti
Un'implementazione del metodo dell'interfaccia PrepareIEnlistmentNotification chiama questo metodo per indicare che la transazione deve essere eseguito il rollback.
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 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 |
.NET Standard | 2.0, 2.1 |
- Origine:
- PreparingEnlistment.cs
- Origine:
- PreparingEnlistment.cs
- Origine:
- PreparingEnlistment.cs
Indica che deve essere eseguito il rollback della transazione.
public:
void ForceRollback(Exception ^ e);
public void ForceRollback (Exception? e);
public void ForceRollback (Exception e);
member this.ForceRollback : Exception -> unit
Public Sub ForceRollback (e As Exception)
Parametri
Spiegazione del motivo per cui viene avviato un rollback.
Si applica a
.NET 9 e altre versioni
Prodotto | Versioni |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 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 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: