Bagikan melalui


LogRecordSequence.CreateReservationCollection Metode

Definisi

Membuat baru ReservationCollection. Metode ini tidak dapat diwariskan.

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

Mengembalikan

Yang baru dibuat ReservationCollection.

Penerapan

Pengecualian

Memori tidak cukup untuk melanjutkan eksekusi program.

Contoh

Reservasi dapat dilakukan dengan dua cara seperti yang ditunjukkan dalam contoh berikut. Anda dapat mengadopsi praktik dalam sampel untuk pemrosesan yang kuat. Perhatikan bahwa tugas ini hanya dapat dilakukan saat menggunakan kelas berbasis LogRecordSequence CLFS.

//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);  

Berlaku untuk