LogRecordSequence.CreateReservationCollection Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a new ReservationCollection. This method cannot be inherited.

Namespace:   System.IO.Log
Assembly:  System.IO.Log (in System.IO.Log.dll)

public ReservationCollection CreateReservationCollection()

Return Value

Type: System.IO.Log.ReservationCollection

The newly created ReservationCollection.

Exception Condition
OutOfMemoryException

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

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

.NET Framework
Available since 3.0
Return to top
Show: