Compensator.PrepareRecord 方法

在准备阶段期间以前向顺序传递日志记录。

**命名空间:**System.EnterpriseServices.CompensatingResourceManager
**程序集:**System.EnterpriseServices(在 system.enterpriseservices.dll 中)

语法

声明
Public Overridable Function PrepareRecord ( _
    rec As LogRecord _
) As Boolean
用法
Dim instance As Compensator
Dim rec As LogRecord
Dim returnValue As Boolean

returnValue = instance.PrepareRecord(rec)
public virtual bool PrepareRecord (
    LogRecord rec
)
public:
virtual bool PrepareRecord (
    LogRecord^ rec
)
public boolean PrepareRecord (
    LogRecord rec
)
public function PrepareRecord (
    rec : LogRecord
) : boolean

参数

  • rec
    要转发的日志记录。

返回值

如果应忘记传递的记录,为 true;否则为 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
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:
    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 boolean PrepareRecord(LogRecord log)
{
    // Check the validity of the record.
    if (log == null) {
        return true;
    }
    Object record[] = new Object[] { log.get_Record() };

    if (record == null) {
        return true;
    }
    if (record.get_Length() != 2) {
        return true;
    }
    // The record is valid.
    receivedPrepareRecord = true;
    return false;
} //PrepareRecord

.NET Framework 安全性

  • 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见。

平台

Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

Compensator 类
Compensator 成员
System.EnterpriseServices.CompensatingResourceManager 命名空间