LogRecordSequence Constructor (String, FileMode, FileAccess, FileShare)

 

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

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

public LogRecordSequence(
	string path,
	FileMode mode,
	FileAccess access,
	FileShare share
)

Parameters

path
Type: System.String

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

mode
Type: System.IO.FileMode

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

access
Type: System.IO.FileAccess

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

share
Type: System.IO.FileShare

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

Exception Condition
ArgumentNullException

path is null.

ArgumentException

path is an empty string ("").

-or-

path contains only white space.

-or-

path contains one or more invalid characters.

ArgumentOutOfRangeException

mode contains an invalid value.

FileNotFoundException

The file cannot be found.

IOException

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

UnauthorizedAccessException

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

NotSupportedException

This operation is not supported.

OutOfMemoryException

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

PlatformNotSupportedException

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.

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.

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;

.NET Framework
Available since 3.0
Return to top
Show: