Bewerken

Share via


LogRecordSequence.CreateReservationCollection Method

Definition

Creates a new ReservationCollection. This method cannot be inherited.

public:
 virtual System::IO::Log::ReservationCollection ^ CreateReservationCollection();
public System.IO.Log.ReservationCollection CreateReservationCollection ();
abstract member CreateReservationCollection : unit -> System.IO.Log.ReservationCollection
override this.CreateReservationCollection : unit -> System.IO.Log.ReservationCollection
Public Function CreateReservationCollection () As ReservationCollection

Returns

The newly created ReservationCollection.

Implements

Exceptions

There is not enough memory to continue the execution of the program.

Examples

Reservations can be performed in two ways as shown in the following examples. You can adopt the practices in the samples for robust processing. Notice that this task can only be performed when using the CLFS-based LogRecordSequence class.

//Using the ReserveAndAppend Method  
ReservationCollection reservations = recordSequence.CreateReservationCollection();  
long[] lengthOfUndoRecords = new long[] { 1000 };  
recordSequence.ReserveAndAppend(recordData,  
                                                     userSqn,  
                                                     previousSqn,  
                                                     RecordSequenceAppendOptions.None,  
                                                     reservations,  
                                                     lengthOfUndoRecords);  
recordSequence.Append(undoRecordData,    // If necessary …  
                                    userSqn,  
                                    previousSqn,  
                                    RecordSequenceAppendOptions.ForceFlush,  
                                    reservations);  

// Using the Manual Approach  
ReservationCollection reservations = recordSequence.CreateReservationCollection();  
reservations.Add(lengthOfUndoRecord);  
try  
{  
   recordSequence.Append(recordData, userSqn, previousSqn, RecordAppendOptions.None);  
}  
catch (Exception)  
{  
   reservations.Remove(lengthOfUndoRecord);  
   throw;  
}  

recordSequence.Append(undoRecordData, userSqn, previousSqn, RecordAppendOptions.ForceFlush, reservations);  

Applies to