Compensator.AbortRecord(LogRecord) Method

Definition

Delivers a log record to the Compensating Resource Manager (CRM) Compensator during the abort phase.

C#
public virtual bool AbortRecord(System.EnterpriseServices.CompensatingResourceManager.LogRecord rec);

Parameters

rec
LogRecord

The log record to be delivered.

Returns

true if the delivered record should be forgotten; otherwise, false.

Examples

The following code example demonstrates the implementation of this method.

C#
public override bool AbortRecord (LogRecord log)
{

    // Check the validity of the record.
    if (log == null) return(true);
    Object[] record = log.Record as Object[];
    if (record == null) return(true);
    if (record.Length != 2) return(true);

    // Extract old account data from the record.
    string filename = (string) record[0];
    int balance = (int) record[1];

    // Restore the old state of the account.
    AccountManager.WriteAccountBalance(filename, balance);

    return(false);
}

Applies to

Proizvod Verzije
.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