Class MongoGridFSFileInfo
Represents information about a GridFS file (patterned after .NET's FileInfo class).
public class MongoGridFSFileInfo : IEquatable<MongoGridFSFileInfo>
- Inheritance
-
MongoGridFSFileInfo
- Implements
- Inherited Members
- Extension Methods
Constructors
MongoGridFSFileInfo(MongoGridFS, string)
Initializes a new instance of the GridFSFileInfo class.
[Obsolete("Use a different constructor instead.")]
public MongoGridFSFileInfo(MongoGridFS gridFS, string remoteFileName)
Parameters
gridFSMongoGridFSThe GridFS file system that contains the GridFS file.
remoteFileNamestringThe remote file name.
MongoGridFSFileInfo(MongoGridFS, string, MongoGridFSCreateOptions)
Initializes a new instance of the GridFSFileInfo class.
[Obsolete("Use a different constructor instead.")]
public MongoGridFSFileInfo(MongoGridFS gridFS, string remoteFileName, MongoGridFSCreateOptions createOptions)
Parameters
gridFSMongoGridFSThe GridFS file system that contains the GridFS file.
remoteFileNamestringThe remote file name.
createOptionsMongoGridFSCreateOptionsThe create options.
MongoGridFSFileInfo(MongoGridFS, string, int)
Initializes a new instance of the GridFSFileInfo class.
[Obsolete("Use a different constructor instead.")]
public MongoGridFSFileInfo(MongoGridFS gridFS, string remoteFileName, int chunkSize)
Parameters
gridFSMongoGridFSThe GridFS file system that contains the GridFS file.
remoteFileNamestringThe remote file name.
chunkSizeintThe chunk size.
MongoGridFSFileInfo(MongoServer, MongoServerInstance, string, MongoGridFSSettings, BsonDocument)
Initializes a new instance of the MongoGridFSFileInfo class.
public MongoGridFSFileInfo(MongoServer server, MongoServerInstance serverInstance, string databaseName, MongoGridFSSettings gridFSSettings, BsonDocument fileInfo)
Parameters
serverMongoServerThe server.
serverInstanceMongoServerInstanceThe server instance.
databaseNamestringName of the database.
gridFSSettingsMongoGridFSSettingsThe GridFS settings.
fileInfoBsonDocumentThe fileInfo.
MongoGridFSFileInfo(MongoServer, MongoServerInstance, string, MongoGridFSSettings, string)
Initializes a new instance of the MongoGridFSFileInfo class.
public MongoGridFSFileInfo(MongoServer server, MongoServerInstance serverInstance, string databaseName, MongoGridFSSettings gridFSSettings, string remoteFileName)
Parameters
serverMongoServerThe server.
serverInstanceMongoServerInstanceThe server instance.
databaseNamestringName of the database.
gridFSSettingsMongoGridFSSettingsThe GridFS settings.
remoteFileNamestringThe remote file name.
MongoGridFSFileInfo(MongoServer, MongoServerInstance, string, MongoGridFSSettings, string, MongoGridFSCreateOptions)
Initializes a new instance of the MongoGridFSFileInfo class.
public MongoGridFSFileInfo(MongoServer server, MongoServerInstance serverInstance, string databaseName, MongoGridFSSettings gridFSSettings, string remoteFileName, MongoGridFSCreateOptions createOptions)
Parameters
serverMongoServerThe server.
serverInstanceMongoServerInstanceThe server instance.
databaseNamestringName of the database.
gridFSSettingsMongoGridFSSettingsThe GridFS settings.
remoteFileNamestringThe remote file name.
createOptionsMongoGridFSCreateOptionsThe create options.
Properties
Aliases
Gets the aliases.
public string[] Aliases { get; }
Property Value
- string[]
ChunkSize
Gets the chunk size.
public int ChunkSize { get; }
Property Value
ContentType
Gets the content type.
public string ContentType { get; }
Property Value
DatabaseName
Gets the database name.
public string DatabaseName { get; }
Property Value
Exists
Gets a value indicating whether the GridFS file exists.
public bool Exists { get; }
Property Value
GridFS
Gets the GridFS file system that contains this GridFS file.
public MongoGridFS GridFS { get; }
Property Value
GridFSSettings
Gets the GridFS settings.
public MongoGridFSSettings GridFSSettings { get; }
Property Value
Id
Gets the GridFS file Id.
public BsonValue Id { get; }
Property Value
Length
Gets the file lenth.
public long Length { get; }
Property Value
MD5
Gets the MD5 hash of the file contents.
public string MD5 { get; }
Property Value
Metadata
Gets the metadata.
public BsonDocument Metadata { get; }
Property Value
Name
Gets the remote file name.
public string Name { get; }
Property Value
Server
Gets the server.
public MongoServer Server { get; }
Property Value
ServerInstance
Gets the server instance;
public MongoServerInstance ServerInstance { get; }
Property Value
UploadDate
Gets the upload date.
public DateTime UploadDate { get; }
Property Value
Methods
AppendText()
Appends UTF-8 encoded text to an existing GridFS file.
public StreamWriter AppendText()
Returns
- StreamWriter
A StreamWriter.
CopyTo(string)
Copies a GridFS file.
public MongoGridFSFileInfo CopyTo(string destFileName)
Parameters
destFileNamestringThe destination file name.
Returns
- MongoGridFSFileInfo
The file info of the new GridFS file.
CopyTo(string, MongoGridFSCreateOptions)
Copies a GridFS file.
public MongoGridFSFileInfo CopyTo(string destFileName, MongoGridFSCreateOptions createOptions)
Parameters
destFileNamestringThe destination file name.
createOptionsMongoGridFSCreateOptionsThe create options.
Returns
- MongoGridFSFileInfo
The file info of the new GridFS file.
Create()
Creates or overwrites a GridFS file.
public MongoGridFSStream Create()
Returns
- MongoGridFSStream
A stream.
CreateText()
Creates or opens a GridFS file for writing UTF-8 encoded text.
public StreamWriter CreateText()
Returns
- StreamWriter
A stream.
Delete()
Deletes a GridFS file.
public void Delete()
Equals(MongoGridFSFileInfo)
Determines whether this instance and another specified MongoGridFSFileInfo object have the same value.
public bool Equals(MongoGridFSFileInfo rhs)
Parameters
rhsMongoGridFSFileInfoThe MongoGridFSFileInfo object to compare to this instance.
Returns
- bool
True if the value of the rhs parameter is the same as this instance; otherwise, false.
Equals(MongoGridFSFileInfo, MongoGridFSFileInfo)
Determines whether two specified MongoGridFSFileInfo objects have the same value.
public static bool Equals(MongoGridFSFileInfo lhs, MongoGridFSFileInfo rhs)
Parameters
lhsMongoGridFSFileInfoThe first value to compare, or null.
rhsMongoGridFSFileInfoThe second value to compare, or null.
Returns
- bool
True if the value of lhs is the same as the value of rhs; otherwise, false.
Equals(object)
Determines whether this instance and a specified object, which must also be a MongoGridFSFileInfo object, have the same value.
public override bool Equals(object obj)
Parameters
objobjectThe MongoGridFSFileInfo object to compare to this instance.
Returns
- bool
True if obj is a MongoGridFSFileInfo object and its value is the same as this instance; otherwise, false.
GetHashCode()
Returns the hash code for this MongoGridFSFileInfo object.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
MoveTo(string)
Moves the most recent version of a GridFS file.
public void MoveTo(string destFileName)
Parameters
destFileNamestringThe destination file name.
Open(FileMode)
Opens a GridFS file with the specified mode.
public MongoGridFSStream Open(FileMode mode)
Parameters
modeFileModeThe mode.
Returns
- MongoGridFSStream
A stream.
Open(FileMode, FileAccess)
Opens a GridFS file with the specified mode and access.
public MongoGridFSStream Open(FileMode mode, FileAccess access)
Parameters
modeFileModeThe mode.
accessFileAccessThe access.
Returns
- MongoGridFSStream
A stream.
OpenRead()
Opens an existing GridFS file for reading.
public MongoGridFSStream OpenRead()
Returns
- MongoGridFSStream
A stream.
OpenText()
Opens an existing UTF-8 encoded text GridFS file for reading.
public StreamReader OpenText()
Returns
- StreamReader
A stream reader.
OpenWrite()
Opens an existing GridFS file for writing.
public MongoGridFSStream OpenWrite()
Returns
- MongoGridFSStream
A stream.
Refresh()
Refreshes the GridFS file info from the server.
public void Refresh()
Operators
operator ==(MongoGridFSFileInfo, MongoGridFSFileInfo)
Determines whether two specified MongoGridFSFileInfo objects have the same value.
public static bool operator ==(MongoGridFSFileInfo lhs, MongoGridFSFileInfo rhs)
Parameters
lhsMongoGridFSFileInfoThe first value to compare, or null.
rhsMongoGridFSFileInfoThe second value to compare, or null.
Returns
- bool
True if the value of lhs is the same as the value of rhs; otherwise, false.
operator !=(MongoGridFSFileInfo, MongoGridFSFileInfo)
Determines whether two specified MongoGridFSFileInfo objects have different values.
public static bool operator !=(MongoGridFSFileInfo lhs, MongoGridFSFileInfo rhs)
Parameters
lhsMongoGridFSFileInfoThe first value to compare, or null.
rhsMongoGridFSFileInfoThe second value to compare, or null.
Returns
- bool
True if the value of lhs is different from the value of rhs; otherwise, false.