RecordAppendOptions 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定如何追加记录。
此枚举支持其成员值的按位组合。
public enum class RecordAppendOptions
[System.Flags]
public enum RecordAppendOptions
[<System.Flags>]
type RecordAppendOptions =
Public Enum RecordAppendOptions
- 继承
- 属性
字段
ForceAppend | 1 | 追加此记录后,记录序列应开始刷新内部缓冲区的过程。 这并不表示在追加操作完成之前应持久写入该记录。 若要获得该行为,请指定 ForceFlush 标志。 |
ForceFlush | 2 | 追加此记录后,记录序列应刷新所有内部缓冲区。 在追加操作完成时,已持久写入指定的记录。 |
None | 0 | 被动地写入数据。 |
示例
下面的示例演示如何结合使用此枚举与 Append 方法,向日志序列追加记录。
// Append records. Appending three records.
public void AppendRecords()
{
Console.WriteLine("Appending Log Records...");
SequenceNumber previous = SequenceNumber.Invalid;
previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
Console.WriteLine("Done...");
}
' Append records. Appending three records.
Public Sub AppendRecords()
Console.WriteLine("Appending Log Records...")
Dim previous As SequenceNumber = SequenceNumber.Invalid
previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
Console.WriteLine("Done...")
End Sub