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