Редагувати

Поділитися через


LogRecordSequence Constructors

Definition

Initializes a new instance of the LogRecordSequence class.

Overloads

LogRecordSequence(LogStore)

Initializes a new instance of the LogRecordSequence class with the specified log store.

LogRecordSequence(String, FileMode)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access mode.

LogRecordSequence(LogStore, Int32, Int32)

Initializes a new instance of the LogRecordSequence class with the specified log store, buffer size for each record, and buffer number.

LogRecordSequence(String, FileMode, FileAccess)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access and share modes.

LogRecordSequence(String, FileMode, FileAccess, FileShare)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access mode.

LogRecordSequence(String, FileMode, FileAccess, FileShare, Int32, Int32)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store, file permission, access and share modes, and the buffer size and count for records.

LogRecordSequence(String, FileMode, FileAccess, FileShare, Int32, Int32, FileSecurity)

Initializes a new instance of the LogRecordSequence class.

LogRecordSequence(LogStore)

Initializes a new instance of the LogRecordSequence class with the specified log store.

public:
 LogRecordSequence(System::IO::Log::LogStore ^ logStore);
public LogRecordSequence (System.IO.Log.LogStore logStore);
new System.IO.Log.LogRecordSequence : System.IO.Log.LogStore -> System.IO.Log.LogRecordSequence
Public Sub New (logStore As LogStore)

Parameters

logStore
LogStore

The LogStore that this record sequence should use.

Exceptions

logStore is invalid.

Remarks

The buffer size determines the maximum size of the record that can be appended or read. In this constructor, a default value of 64 is set. The desired number of buffers is set to 10.

Applies to

LogRecordSequence(String, FileMode)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access mode.

public:
 LogRecordSequence(System::String ^ path, System::IO::FileMode mode);
public LogRecordSequence (string path, System.IO.FileMode mode);
new System.IO.Log.LogRecordSequence : string * System.IO.FileMode -> System.IO.Log.LogRecordSequence
Public Sub New (path As String, mode As FileMode)

Parameters

path
String

A relative or absolute path for the base file of the log store to open.

mode
FileMode

One of the FileMode values that determines how to open or create the store.

Exceptions

path is null.

path is an empty string ("").

-or-

path contains only white space.

-or-

path contains one or more invalid characters.

mode contains an invalid value.

The file cannot be found.

An I/O error occurs when opening the log store.

Access for the specified log sequence is denied by the operating system.

This operation is not supported.

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

LogRecordSequence cannot be used because the required Common Log File System (CLFS) component is not installed. Install the CLFS component if it is available for your platform, or use the FileRecordSequence class.

Remarks

This constructor initializes a new LogRecordSequence on a new LogStore object that it opens with the specified path and mode. It is given read/write access to the store, and the store is opened sharing Read access.

Applies to

LogRecordSequence(LogStore, Int32, Int32)

Initializes a new instance of the LogRecordSequence class with the specified log store, buffer size for each record, and buffer number.

public:
 LogRecordSequence(System::IO::Log::LogStore ^ logStore, int bufferSize, int bufferCount);
public LogRecordSequence (System.IO.Log.LogStore logStore, int bufferSize, int bufferCount);
new System.IO.Log.LogRecordSequence : System.IO.Log.LogStore * int * int -> System.IO.Log.LogRecordSequence
Public Sub New (logStore As LogStore, bufferSize As Integer, bufferCount As Integer)

Parameters

logStore
LogStore

The LogStore that this record sequence should use.

bufferSize
Int32

The desired buffer size in bytes. The buffer size determines the maximum size of the record that can be appended or read.

bufferCount
Int32

The desired number of buffers.

Exceptions

logStore is null.

bufferSize is negative or zero.

-or-

bufferCount is negative or zero.

Remarks

Use this constructor if you want to specify values for bufferSize and bufferCount and do not want to use the default value of 64 for bufferSize and 10 for bufferCount.

Applies to

LogRecordSequence(String, FileMode, FileAccess)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access and share modes.

public:
 LogRecordSequence(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access);
public LogRecordSequence (string path, System.IO.FileMode mode, System.IO.FileAccess access);
new System.IO.Log.LogRecordSequence : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.Log.LogRecordSequence
Public Sub New (path As String, mode As FileMode, access As FileAccess)

Parameters

path
String

A relative or absolute path for the base file of the log store to open.

mode
FileMode

One of the FileMode values that determines how to open or create the store.

access
FileAccess

One of the FileAccess values that determines how the file can be accessed by the LogStore.

Exceptions

path is null.

path is an empty string ("").

-or-

path contains only white space.

-or-

path contains one or more invalid characters.

mode contains an invalid value.

The file cannot be found.

An I/O error occurs when opening the log store.

Access for the specified log sequence is denied by the operating system.

This operation is not supported.

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

LogRecordSequence cannot be used because the required Common Log File System (CLFS) component is not installed. Install the CLFS component if it is available for your platform, or use the FileRecordSequence class.

Remarks

This constructor initializes a new LogRecordSequence on a new LogStore object that it opens with the specified path, mode, and access. The store is opened sharing Read access.

Applies to

LogRecordSequence(String, FileMode, FileAccess, FileShare)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store and the access mode.

public:
 LogRecordSequence(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share);
public LogRecordSequence (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
new System.IO.Log.LogRecordSequence : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.Log.LogRecordSequence
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare)

Parameters

path
String

A relative or absolute path for the base file of the log store to open.

mode
FileMode

One of the FileMode values that determines how to open or create the store.

access
FileAccess

One of the FileAccess values that determines how the file can be accessed by the LogStore.

share
FileShare

One of the FileShare values that determines how the log store will be shared among processes.

Exceptions

path is null.

path is an empty string ("").

-or-

path contains only white space.

-or-

path contains one or more invalid characters.

mode contains an invalid value.

The file cannot be found.

An I/O error occurs when opening the log store.

Access for the specified log sequence is denied by the operating system.

This operation is not supported.

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

LogRecordSequence cannot be used because the required Common Log File System (CLFS) component is not installed. Install the CLFS component if it is available for your platform, or use the FileRecordSequence class.

Examples

This example shows how to use this LogRecordSequence constructor:

// Create a LogRecordSequence.
sequence = new LogRecordSequence(this.logName,
                                  FileMode.CreateNew,
                                  FileAccess.ReadWrite,
                                  FileShare.None);

// At least one container/extent must be added for Log Record Sequence.
sequence.LogStore.Extents.Add(this.logContainer, this.containerSize);

MySequence = sequence;
' Create a LogRecordSequence.
sequence = New LogRecordSequence(Me.logName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None)

' At least one container/extent must be added for Log Record Sequence.
sequence.LogStore.Extents.Add(Me.logContainer, Me.containerSize)

MySequence = sequence

Remarks

This constructor initializes a new LogRecordSequence on a new LogStore object that it opens with the specified path, mode, and access. The store is opened sharing the specified access.

Applies to

LogRecordSequence(String, FileMode, FileAccess, FileShare, Int32, Int32)

Initializes a new instance of the LogRecordSequence class with a specified path to the log store, file permission, access and share modes, and the buffer size and count for records.

public:
 LogRecordSequence(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize, int bufferCount);
public LogRecordSequence (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, int bufferCount);
new System.IO.Log.LogRecordSequence : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int * int -> System.IO.Log.LogRecordSequence
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer, bufferCount As Integer)

Parameters

path
String

A relative or absolute path for the base file of the log store to open.

mode
FileMode

One of the FileMode values that determines how to open or create the store.

access
FileAccess

One of the FileAccess values that determines how the file can be accessed by the LogStore.

share
FileShare

One of the FileShare values that determines how the log store will be shared among processes.

bufferSize
Int32

The desired buffer size in bytes. The buffer size determines the maximum size of the record that can be appended or read.

bufferCount
Int32

The desired number of buffers.

Exceptions

path is null.

path is an empty string ("").

-or-

path contains only white space.

-or-

path contains one or more invalid characters.

mode contains an invalid value.

The file cannot be found.

An I/O error occurs when opening the log store.

Access for the specified log sequence is denied by the operating system.

This operation is not supported.

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

LogRecordSequence cannot be used because the required Common Log File System (CLFS) component is not installed. Install the CLFS component if it is available for your platform, or use the FileRecordSequence class.

Remarks

This constructor initializes a new LogRecordSequence on a new LogStore object that it opens with the specified path, mode, and access. The store is opened sharing the specified access.

Applies to

LogRecordSequence(String, FileMode, FileAccess, FileShare, Int32, Int32, FileSecurity)

Initializes a new instance of the LogRecordSequence class.

public:
 LogRecordSequence(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize, int bufferCount, System::Security::AccessControl::FileSecurity ^ fileSecurity);
public LogRecordSequence (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, int bufferCount, System.Security.AccessControl.FileSecurity fileSecurity);
new System.IO.Log.LogRecordSequence : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int * int * System.Security.AccessControl.FileSecurity -> System.IO.Log.LogRecordSequence
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer, bufferCount As Integer, fileSecurity As FileSecurity)

Parameters

path
String

A relative or absolute path for the base file of the log store to open.

mode
FileMode

A valid FileMode value that determines how to open or create the store.

access
FileAccess

A valid FileAccess value that determines how the log store can be accessed.

share
FileShare

A valid FileShare value that determines how the log store will be shared among processes.

bufferSize
Int32

The desired buffer size in bytes. The buffer size determines the maximum size of the record that can be appended or read.

bufferCount
Int32

The desired number of buffers.

fileSecurity
FileSecurity

A valid FileSecurity value that specifies the security to set on the newly created store if the store must be created.

Exceptions

The file specified by path is not valid.

-or-

The specified log store file name is not valid.

-or-

mode has a value of CreateNew, and cannot be used without write access.

-or-

mode has a value of OpenOrCreate, and cannot be used without write access.

One or more of the arguments are null.

One or more of the arguments are out of range.

The file specified by path cannot be found.

The request could not be performed because of an unexpected I/O exception.

-or-

The file specified by path cannot be accessed because it is in use by another process.

-or-

The file specified by path cannot be created because the file or directory already exists.

-or-

The log handle could not be bound to the thread pool.

-or-

The specified log file format or version is invalid.

This operation is not supported.

The method was called after the sequence has been disposed of.

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

LogRecordSequence cannot be used because the required Common Log File System (CLFS) component is not installed. Install the CLFS component if it is available for your platform, or use the FileRecordSequence class.

The record sequence is full.

Access for the specified log sequence is denied by the operating system.

Applies to