LogRecord 类

定义

表示作为 COM+ CrmLogRecordRead 结构传递的未结构化的日志记录。Represents an unstructured log record delivered as a COM+ CrmLogRecordRead structure. 此类不能被继承。This class cannot be inherited.

public ref class LogRecord sealed
public sealed class LogRecord
type LogRecord = class
Public NotInheritable Class LogRecord
继承
LogRecord

示例

下面的代码示例演示如何使用此类。The following code example demonstrates the use of this class.

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 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 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

注解

非结构化日志记录作为 com + CrmLogRecordRead结构传递。Unstructured log records are delivered as a COM+ CrmLogRecordRead structure. 除了用户数据 (单个 BLOB), 这还包含对调试或错误查找有用的其他字段。In addition to the user data (a single BLOB), this contains additional fields that are useful for debugging or fault finding. Flags字段是一个位字段, 它提供有关此记录在某个时间点是否被忘记以及何时写入的详细信息。The Flags field is a bit field that provides further information about whether this record was forgotten at some point, and when it was written. Sequence字段提供日志记录的序列号。The Sequence field provides the sequence number of the log record. 在大多数情况下, 序列号是连续的, 但并不一定是连续的, 因为未传递到补偿资源管理器 (CRM) 补偿器的内部日志记录。In most cases, sequence numbers are sequential but are not necessarily contiguous due to internal log records that are not delivered to the Compensating Resource Manager (CRM) Compensator.

属性

Flags

获取一个值,该值指示何时写入日志记录。Gets a value that indicates when the log record was written.

Record

获取日志记录用户数据。Gets the log record user data.

Sequence

日志记录的序列号。The sequence number of the log record.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于