LogRecord 類別

定義

表示當做 COM+ CrmLogRecordRead 結構傳送的非結構化記錄檔資料錄。 此類別無法獲得繼承。

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

範例

下列程式代碼範例示範這個類別的使用。

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 結構的形式傳遞。 除了單一 BLOB) (用戶數據之外,還包含其他欄位,可用於偵錯或錯誤尋找。 欄位元字段 Flags ,提供有關此記錄是否在某個時間點忘記,以及寫入時間的進一步資訊。 欄位 Sequence 會提供記錄檔記錄的序號。 在大部分情況下,序號是循序的,但不一定是連續的,因為不會傳遞至補償 Resource Manager (CRM) 補償器的內部記錄檔記錄。

屬性

Flags

取得值,指出何時寫入記錄檔資料錄。

Record

取得記錄檔資料錄使用者資料。

Sequence

記錄檔資料錄的序號。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於