LogRecordSequence.CreateReservationCollection Method     
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.ReservationCollectionPublic Function CreateReservationCollection () As ReservationCollectionReturns
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);