Compensator.AbortRecord(LogRecord) 方法

定义

在中断阶段期间将日志记录传递到补偿资源管理器 (CRM) 补偿器。

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

参数

rec
LogRecord

要传递的日志记录。

返回

如果应忘记传递的记录,为 true;否则为 false

示例

下面的代码示例演示此方法的实现。

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);
}

适用于

产品 版本
.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