Class File
Provides a general-purpose binary storage for a large object.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Entities
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class File : DomainObjectBase, IValidator, IExtensibleDataObject, IEquatable<File>
Constructors
File()
Initializes an empty instance.
Declaration
public File()
File(Byte[], FileType)
Creates new temporary file from provided bytes.
Declaration
public File(byte[] content, FileType contentType)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | content | Bytes to be written to the file. |
FileType | contentType | File content type. |
File(MetadataSet)
Creates new temporary file from provided service metadata.
Declaration
public File(MetadataSet metadata)
Parameters
Type | Name | Description |
---|---|---|
MetadataSet | metadata | Metadata to be initialized from. |
File(String, FileType)
Creates new temporary file from provided text string.
Declaration
public File(string content, FileType contentType)
Parameters
Type | Name | Description |
---|---|---|
String | content | Text to be written to the file. |
FileType | contentType | File content type. |
Fields
DefaultExpiration
Default expiration time period for a temporary file.
Declaration
public static readonly TimeSpan DefaultExpiration
Field Value
Type | Description |
---|---|
TimeSpan |
Properties
Content
Gets or sets the binary content of the file.
Declaration
public byte[] Content { get; set; }
Property Value
Type | Description |
---|---|
Byte[] |
ContentType
Gets or sets the type of the stored content.
Declaration
public FileType ContentType { get; set; }
Property Value
Type | Description |
---|---|
FileType |
Expired
Gets or sets the date and time when file expires and can be deleted. If Null, then file never expires.
Declaration
public DateTime? Expired { get; set; }
Property Value
Type | Description |
---|---|
Nullable<DateTime> |
FileName
Gets or sets the original file name on disk.
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
String |
LastUpdated
Gets the date and time when file was updated or created.
Declaration
public DateTime LastUpdated { get; }
Property Value
Type | Description |
---|---|
DateTime |
ObjectType
Gets object type identifier.
Declaration
public override EntityType ObjectType { get; }
Property Value
Type | Description |
---|---|
EntityType |
Overrides
Methods
Equals(File)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(File other)
Parameters
Type | Name | Description |
---|---|---|
File | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | True, if objects are equal. False, if objects are not equal. |
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | True, if objects are equal. False, if objects are not equal. |
Overrides
GetContentAsMetadata()
Retrieves metadata stored in the file.
Declaration
public MetadataSet GetContentAsMetadata()
Returns
Type | Description |
---|---|
MetadataSet | Metadata stored in the file or Null, if content is empty. |
GetContentAsText()
Retrieves text string stored in the file content.
Declaration
public string GetContentAsText()
Returns
Type | Description |
---|---|
String | Text string stored in the file content or Null, if content is empty. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Hash code of the current instance. |
Overrides
Validate()
Evaluates the state of this object.
Declaration
public override bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if state is valid; otherwise, false. |