Class MediaFileInfo
- Namespace
- CMS.MediaLibrary
- Assembly
- CMS.MediaLibrary.dll
Media file info data container class.
[InfoCache(InfoCacheBy.ID|InfoCacheBy.Guid)]
public class MediaFileInfo : AbstractInfo<MediaFileInfo, IMediaFileInfoProvider>, IExtensible, IInfo, IAdvancedDataContainer, ICMSObject, IHierarchicalDataContainer, IDataContainer, ISimpleDataContainer, IVirtualHierarchicalObject, IHierarchicalObject, INameIndexable, IMacroObject, IInfoWithId, IInfoWithGuid
- Inheritance
-
objectMediaFileInfo
- Implements
- Inherited Members
- Extension Methods
Constructors
MediaFileInfo()
Constructor - Creates an empty MediaFileInfo object.
public MediaFileInfo()
MediaFileInfo(IUploadedFile, int)
Constructor - creates a new MediaFileInfo object from posted file.
public MediaFileInfo(IUploadedFile uploadedFile, int libraryId)
Parameters
uploadedFile
IUploadedFilePosted file
libraryId
intID of the library the file will be assigned to
MediaFileInfo(IUploadedFile, int, string, int, int, int)
Constructor - creates a new MediaFileInfo object from posted file.
public MediaFileInfo(IUploadedFile uploadedFile, int libraryId, string librarySubfolder, int width, int height, int maxSideSize)
Parameters
uploadedFile
IUploadedFilePosted file
libraryId
intID of the library the file will be assigned to
librarySubfolder
stringLibrary subfolder path where file should be saved
width
intWidth of the image
height
intHeight of the image
maxSideSize
intMax side size of the image
MediaFileInfo(MediaFileInfo, bool)
Creates a new MediaFileInfo object from the existing MediaFileInfo object. Copy constructor.
public MediaFileInfo(MediaFileInfo info, bool keepSourceData)
Parameters
info
MediaFileInfoOriginal object to copy
keepSourceData
boolIf true, the copy is shallow, otherwise a deep copy is created (all object's data is cloned)
MediaFileInfo(DataRow)
Constructor - Creates a new MediaFileInfo object from the given DataRow.
public MediaFileInfo(DataRow dr)
Parameters
dr
DataRow
MediaFileInfo(string, int)
Constructor - creates a new MediaFileInfo object specified by its file physical path.
public MediaFileInfo(string path, int libraryId)
Parameters
path
stringFile physical path
libraryId
intID of the library the file will be assigned to
MediaFileInfo(string, int, string)
Constructor - creates a new MediaFileInfo object specified by its file physical path.
public MediaFileInfo(string path, int libraryId, string librarySubfolder)
Parameters
path
stringFile physical path
libraryId
intID of the library the file will be assigned to
librarySubfolder
stringLibrary subfolder path where file should be saved
MediaFileInfo(string, int, string, int, int, int)
Constructor - creates a new MediaFileInfo object specified by its file physical path.
public MediaFileInfo(string path, int libraryId, string librarySubfolder, int width, int height, int maxSideSize)
Parameters
path
stringFile physical path
libraryId
intID of the library the file will be assigned to
librarySubfolder
stringLibrary subfolder path where file should be saved
width
intWidth of the image
height
intHeight of the image
maxSideSize
intMax side size of the image
Fields
OBJECT_TYPE
Object type
public const string OBJECT_TYPE = "media.file"
Field Value
- string
TYPEINFO
Type information.
public static ObjectTypeInfo TYPEINFO
Field Value
Properties
FileCreatedByUserID
ID of user who created current file.
public virtual int FileCreatedByUserID { get; set; }
Property Value
- int
FileCreatedWhen
Date ant time when the file was created.
public virtual DateTime FileCreatedWhen { get; set; }
Property Value
- DateTime
FileCustomData
File custom data.
public ContainerCustomData FileCustomData { get; }
Property Value
FileDescription
File description.
public virtual string FileDescription { get; set; }
Property Value
- string
FileExtension
File extension.
public virtual string FileExtension { get; set; }
Property Value
- string
FileGUID
File GUID.
public virtual Guid FileGUID { get; set; }
Property Value
- Guid
FileID
File ID.
public virtual int FileID { get; set; }
Property Value
- int
FileImageHeight
File image height.
public virtual int FileImageHeight { get; set; }
Property Value
- int
FileImageWidth
File image width.
public virtual int FileImageWidth { get; set; }
Property Value
- int
FileLibraryID
File library ID.
public virtual int FileLibraryID { get; set; }
Property Value
- int
FileMimeType
File mime type.
public virtual string FileMimeType { get; set; }
Property Value
- string
FileModifiedByUserID
ID of user who last modified current file.
public virtual int FileModifiedByUserID { get; set; }
Property Value
- int
FileModifiedWhen
Date and time when the file was last modified.
public virtual DateTime FileModifiedWhen { get; set; }
Property Value
- DateTime
FileName
File name.
public virtual string FileName { get; set; }
Property Value
- string
FilePath
File path.
public virtual string FilePath { get; set; }
Property Value
- string
FileSize
File size.
public virtual long FileSize { get; set; }
Property Value
- long
FileTitle
File title.
public virtual string FileTitle { get; set; }
Property Value
- string
Methods
Clone(bool)
Creates a clone of the object
public override MediaFileInfo Clone(bool clear)
Parameters
clear
boolIf true, the object is cleared to be able to create new object
Returns
DeleteObject()
Deletes the object using appropriate provider.
protected override void DeleteObject()
EnsureUniqueFileName(bool)
Sets whether unique file name is to be ensured upon setting the object. The default value is true.
public void EnsureUniqueFileName(bool ensureUniqueFileName)
Parameters
ensureUniqueFileName
boolIndicates if unique file name is to be ensured.
GetUniqueNameWhereCondition(string, string, int, bool)
Constructs base where condition for checking column value uniqueness.
Condition is modified to check name uniqueness on the file path. Name is unique if there is no other file with the same name in the same folder.
protected override WhereCondition GetUniqueNameWhereCondition(string columnName, string searchName, int currentObjectId, bool exactMatch)
Parameters
columnName
stringName of the column in which the uniqueness should be preserved (CodeNameColumn/DisplayNameColumn)
searchName
stringName which should be saved in the column (evenutally with suffix)
currentObjectId
intID of the current object (this object will be excluded from the search for duplicate names)
exactMatch
boolIf true, the names must match exactly
Returns
- WhereCondition
Where condition used to check for unique name
InsertAsCloneInternal(CloneSettings, CloneResult, BaseInfo)
Inserts the file to the database using standard MediaFileInfoProvider.SetMediaFileInfo function.
protected override void InsertAsCloneInternal(CloneSettings settings, CloneResult result, BaseInfo originalObject)
Parameters
settings
CloneSettingsClone settings
result
CloneResultResult
originalObject
BaseInfoOriginal object
LoadDefaultData()
Loads the default object data
protected override void LoadDefaultData()
ResetChanges()
Resets the object changes and keeps the new values as unchanged according to the asUnchanged parameter.
public override void ResetChanges()
SaveFileToDisk(bool)
Sets whether binary file is to be saved upon setting the object. The default value is true.
public void SaveFileToDisk(bool saveFileToDisk)
Parameters
saveFileToDisk
boolIndicates if binary file is to be saved.
SetObject()
Updates the object using appropriate provider.
protected override void SetObject()
SetValue(string, object)
Sets the field value.
public override bool SetValue(string columnName, object value)
Parameters
columnName
stringColumn name
value
objectNew value
Returns
- bool