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 |
---|---|---|
System.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 |
---|---|---|
System.ServiceModel.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 |
---|---|---|
System.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 |
---|---|
System.TimeSpan |
Properties
Content
Gets or sets the binary content of the file.
Declaration
public byte[] Content { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.Nullable<System.DateTime> |
FileName
Gets or sets the original file name on disk.
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
LastUpdated
Gets the date and time when file was updated or created.
Declaration
public DateTime LastUpdated { get; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System.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 |
---|---|
System.ServiceModel.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 |
---|---|
System.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 |
---|---|
System.Int32 | Hash code of the current instance. |
Overrides
Validate()
Evaluates the state of this object.
Declaration
public override bool Validate()
Returns
Type | Description |
---|---|
System.Boolean | True if state is valid; otherwise, false. |