C# Class MongoDB.GridFS.GridFileInfo

Provides instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of GridFileStream objects. The api is very similar to the FileInfo class in System.IO.
Datei anzeigen Open project: sdether/mongodb-csharp Class Usage Examples

Public Methods

Method Description
CalcMD5 ( ) : string
Create ( ) : GridFileStream

Creates the file named FileName and returns the GridFileStream

Create ( FileMode mode ) : GridFileStream
Create ( FileMode mode, FileAccess access ) : GridFileStream
Delete ( ) : void

Permanently removes a file from the database.

GridFileInfo ( Database db, string filename ) : System
GridFileInfo ( Database db, string bucket, string filename ) : System
MoveTo ( String newFileName ) : void

Renames a file.

Open ( FileMode mode, FileAccess access ) : GridFileStream
OpenRead ( ) : GridFileStream

Creates a read-only GridFileStream to an existing file.

OpenWrite ( ) : GridFileStream

Creates a write-only GridFileStream to an existing file.

Refresh ( ) : void

Reloads the file information from the database.

The data in the database will not reflect any changes done through an open stream until it is closed.

ToDocument ( ) : Document
ToString ( ) : string
Truncate ( ) : void

Deletes all data in a file and sets the length to 0.

UpdateInfo ( ) : void

Updates the aliases, contentType, metadata and uploadDate in the database.

To rename a file use the MoveTo method.

Private Methods

Method Description
LoadFileData ( ) : void
SetFileDataDefaults ( string filename ) : void

Method Details

CalcMD5() public method

public CalcMD5 ( ) : string
return string

Create() public method

Creates the file named FileName and returns the GridFileStream
If the file already exists
public Create ( ) : GridFileStream
return GridFileStream

Create() public method

public Create ( FileMode mode ) : GridFileStream
mode FileMode
return GridFileStream

Create() public method

public Create ( FileMode mode, FileAccess access ) : GridFileStream
mode FileMode
access FileAccess
return GridFileStream

Delete() public method

Permanently removes a file from the database.
public Delete ( ) : void
return void

GridFileInfo() public method

public GridFileInfo ( Database db, string filename ) : System
db MongoDB.Driver.Database
filename string
return System

GridFileInfo() public method

public GridFileInfo ( Database db, string bucket, string filename ) : System
db MongoDB.Driver.Database
bucket string
filename string
return System

MoveTo() public method

Renames a file.
public MoveTo ( String newFileName ) : void
newFileName String
return void

Open() public method

public Open ( FileMode mode, FileAccess access ) : GridFileStream
mode FileMode
access FileAccess
return GridFileStream

OpenRead() public method

Creates a read-only GridFileStream to an existing file.
public OpenRead ( ) : GridFileStream
return GridFileStream

OpenWrite() public method

Creates a write-only GridFileStream to an existing file.
public OpenWrite ( ) : GridFileStream
return GridFileStream

Refresh() public method

Reloads the file information from the database.
The data in the database will not reflect any changes done through an open stream until it is closed.
public Refresh ( ) : void
return void

ToDocument() public method

public ToDocument ( ) : Document
return MongoDB.Driver.Document

ToString() public method

public ToString ( ) : string
return string

Truncate() public method

Deletes all data in a file and sets the length to 0.
public Truncate ( ) : void
return void

UpdateInfo() public method

Updates the aliases, contentType, metadata and uploadDate in the database.
To rename a file use the MoveTo method.
public UpdateInfo ( ) : void
return void