LogRecordSequence.CreateReservationCollection Metodo

Definizione

Crea un nuovo oggetto ReservationCollection.Creates a new ReservationCollection. Questo metodo non può essere ereditato.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

Restituisce

Oggetto ReservationCollection appena creato.The newly created ReservationCollection.

Implementazioni

Eccezioni

Memoria insufficiente per continuare l'esecuzione del programma.There is not enough memory to continue the execution of the program.

Esempi

Le prenotazioni possono essere eseguite in due modalità come illustrato negli esempi riportati di seguito.Reservations can be performed in two ways as shown in the following examples. È possibile adottare le pratiche negli esempi per un'elaborazione affidabile.You can adopt the practices in the samples for robust processing. Questa attività può essere eseguita solo se si usa la classe LogRecordSequence basata su CLFS.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);  

Si applica a