Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi, Alex,
You can disassemble the EPiServer dlls in dotPeek and take a peek into the source for MediaData:
[AvailableContentTypes(Availability = Availability.None)]
[AdministrationSettings(GroupName = "mediatypes", Order = 30, PropertyDefinitionFields = (PropertyDefinitionFields) 65471, Visible = true)]
public class MediaData : ContentBase, IContentMedia, IContent, IContentData, IBinaryStorable, IRoutable, ILocale
{
private CultureInfo _language = CultureInfo.InvariantCulture;
public const string ChangedByID = "changedByID";
private string _routeSegment;
private bool _isModified;
private Blob _blob;
private Blob _thumbnail;
private string _mimeType;
[UIHint("previewabletext")]
public string RouteSegment
{
get
{
return this._routeSegment;
}
set
{
this.ThrowIfReadOnly();
this._isModified = true;
this._routeSegment = value;
}
}
protected override bool IsModified
{
get
{
if (!base.IsModified)
return this._isModified;
else
return true;
}
}
[Editable(false)]
public virtual Blob Thumbnail
{
get
{
return this._thumbnail;
}
set
{
this.ThrowIfReadOnly();
this._isModified = true;
this._thumbnail = value;
}
}
public virtual Blob BinaryData
{
get
{
return this._blob;
}
set
{
this.ThrowIfReadOnly();
this._isModified = true;
this._mimeType = (string) null;
this._blob = value;
}
}
public virtual Uri BinaryDataContainer
{
get
{
return Blob.GetContainerIdentifier(this.ContentGuid);
}
}
public virtual string MimeType
{
get
{
if (this._mimeType == null && this.BinaryData != null && this.BinaryData.ID.LocalPath != null)
this._mimeType = MimeMapping.GetMimeMapping(this.BinaryData.ID.LocalPath);
return this._mimeType;
}
}
public CultureInfo Language
{
get
{
return this._language;
}
set
{
this.ThrowIfReadOnly();
this._isModified = true;
this._language = value;
}
}
protected override void ResetModified()
{
base.ResetModified();
this._isModified = false;
}
}
Then, you can take a look at, for example, ImageData or VideoData.
However, I don't see why you can't extend MediaData? What do you need to do?
[Pasting files is not allowed]
I need to create a new media type but I cannot extend the MediaData class so I need to implement the IContentMedia interface but I am unsure as to how to implement the get and set for the Thumbnail, BinaryData, and BinaryDataContainer properties. Please advise.
Thanks!