LogRecord 类

表示作为 COM+ CrmLogRecordRead 结构传递的未结构化的日志记录。无法继承此类。

**命名空间:**System.EnterpriseServices.CompensatingResourceManager
**程序集:**System.EnterpriseServices(在 system.enterpriseservices.dll 中)

语法

声明
Public NotInheritable Class LogRecord
用法
Dim instance As LogRecord
public sealed class LogRecord
public ref class LogRecord sealed
public final class LogRecord
public final class LogRecord

备注

未结构化的日志记录被作为 COM+ CrmLogRecordRead 结构传递。除用户数据(单个 BLOB)之外,其中还包含用于调试或查找故障的其他字段。Flags 字段是位字段,它提供有关在某一时刻是否忘记该记录以及何时写入该记录的进一步信息。Sequence 字段提供日志记录的序列号。在大多数情况下,序列号是按顺序的但不必是连续的,因为内部日志记录不传递到补偿资源管理器 (CRM) 补偿器。

示例

下面的代码示例演示如何使用该类。

Public Overrides Function AbortRecord(ByVal log As LogRecord) As Boolean 
    
    ' Check the validity of the record.
    If log Is Nothing Then
        Return True
    End If
    Dim record As [Object]() = log.Record
    
    If record Is Nothing Then
        Return True
    End If
    If record.Length <> 2 Then
        Return True
    End If 
    ' Extract old account data from the record.
    Dim filename As String = CStr(record(0))
    Dim balance As Integer = Fix(record(1))
    
    ' Restore the old state of the account.
    AccountManager.WriteAccountBalance(filename, balance)
    
    Return False

End Function 'AbortRecord
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);
}
public:
    virtual bool AbortRecord(LogRecord^ log) override
    {

        // Check the validity of the record.
        if (log == nullptr)
        {
            return true;
        }
        array<Object^>^ record = dynamic_cast<array<Object^>^>(log->Record);
        if (record == nullptr)
        {
            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.
        WriteAccountBalance(filename, balance);

        return false;
    }
public boolean AbortRecord(LogRecord log)
{
    // Check the validity of the record.
    if (log == null) {
        return true;
    }
    Object record[] = new Object[] { log.get_Record() };

    if (record == null) {
        return true;
    }
    if (record.get_Length() != 2) {
        return true;
    }
    // Extract old account data from the record.
    String fileName = (String)(record.get_Item(0));
    int balance = System.Convert.ToInt32(record[1]);

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

    return false;
} //AbortRecord

继承层次结构

System.Object
  System.EnterpriseServices.CompensatingResourceManager.LogRecord

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

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 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

LogRecord 成员
System.EnterpriseServices.CompensatingResourceManager 命名空间