LogRecord 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示作为 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 字段提供日志记录的序列号。 在大多数情况下,序列号是连续的,但由于未传递到补偿资源管理器(CRM)补偿程序的内部日志记录,序列号不一定是连续的。
属性
| 名称 | 说明 |
|---|---|
| Flags |
获取一个值,该值指示何时写入日志记录。 |
| Record |
获取日志记录用户数据。 |
| Sequence |
日志记录的序列号。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |