다음을 통해 공유


Compensator.AbortRecord(LogRecord) 메서드

정의

중단 단계에서 CRM(Compensating Resource Manager) Compensator에 로그 레코드를 전달합니다.

public:
 virtual bool AbortRecord(System::EnterpriseServices::CompensatingResourceManager::LogRecord ^ rec);
public virtual bool AbortRecord (System.EnterpriseServices.CompensatingResourceManager.LogRecord rec);
abstract member AbortRecord : System.EnterpriseServices.CompensatingResourceManager.LogRecord -> bool
override this.AbortRecord : System.EnterpriseServices.CompensatingResourceManager.LogRecord -> bool
Public Overridable Function AbortRecord (rec As LogRecord) As Boolean

매개 변수

rec
LogRecord

전달될 로그 레코드입니다.

반환

전달된 레코드가 무시되어야 하면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에는이 메서드의 구현을 보여 줍니다.

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

적용 대상