Compensator.PrepareRecord(LogRecord) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在准备阶段期间以前向顺序传递日志记录。
public:
virtual bool PrepareRecord(System::EnterpriseServices::CompensatingResourceManager::LogRecord ^ rec);
public virtual bool PrepareRecord (System.EnterpriseServices.CompensatingResourceManager.LogRecord rec);
abstract member PrepareRecord : System.EnterpriseServices.CompensatingResourceManager.LogRecord -> bool
override this.PrepareRecord : System.EnterpriseServices.CompensatingResourceManager.LogRecord -> bool
Public Overridable Function PrepareRecord (rec As LogRecord) As Boolean
参数
- rec
- LogRecord
要转发的日志记录。
返回
如果应忘记传递的记录,为 true
;否则为 false
。
示例
下面的代码示例演示此方法的实现。
public:
virtual bool PrepareRecord(LogRecord^ log) override
{
// Check the validity of the record.
if (log == nullptr)
{
return false;
}
array<Object^>^ record = dynamic_cast<array<Object^>^>(log->Record);
if (record == nullptr)
{
return false;
}
if (record->Length != 2)
{
return false;
}
// The record is valid.
receivedPrepareRecord = true;
return true;
}
public override bool PrepareRecord (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);
// The record is valid.
receivedPrepareRecord = true;
return(false);
}
Public Overrides Function PrepareRecord(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
' The record is valid.
receivedPrepareRecord = True
Return False
End Function 'PrepareRecord