Class MediaReferenceBase
This class describes the data stored in the PropertyMedia and is used as a reference to lookup media from ImageVault. Here we store the Id of the selected media, edits for the media and additional meta data entered by the EPiServer editor.
Inherited Members
Namespace: ImageVault.EPiServer.Common
Assembly: ImageVault.EPiServer.Common.dll
Syntax
public class MediaReferenceBase : ICloneable, IReadOnlyItem<MediaReferenceBase>
Constructors
MediaReferenceBase()
Initializes a new instance of the MediaReferenceBase class.
Declaration
public MediaReferenceBase()
MediaReferenceBase(MediaReferenceBase)
Initializes a new instance of the MediaReferenceBase class.
Declaration
public MediaReferenceBase(MediaReferenceBase mediaReferenceBase)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaReferenceBase | mediaReferenceBase |
Fields
MediaSerializerSettings
Gets the MediaSerializerSettings of the MediaReferenceBase
Declaration
public static readonly JsonSerializerSettings MediaSerializerSettings
Field Value
| Type | Description |
|---|---|
| Newtonsoft.Json.JsonSerializerSettings |
Properties
Channels
Declaration
public ModifiedList<Channel> Channels { get; }
Property Value
| Type | Description |
|---|---|
| ModifiedList<Channel> |
Effects
Gets the Effects of the MediaReferenceBase
Declaration
public ModifiedList<Effect> Effects { get; }
Property Value
| Type | Description |
|---|---|
| ModifiedList<Effect> |
Id
Get/Sets the Id of the MediaReferenceBase
Declaration
public int Id { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | An integer describing the id of the media from ImageVault |
IsModified
Get/Sets the IsModified of the Media
Declaration
public bool IsModified { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsReadOnly
Gets the IsReadOnly of the MediaReferenceBase
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Clone()
Clones the MediaReferenceBase to a new instance
Declaration
public virtual MediaReferenceBase Clone()
Returns
| Type | Description |
|---|---|
| MediaReferenceBase |
Equals(MediaReferenceBase)
Determines whether the specified MediaReferenceBase is equal to the current MediaReferenceBase.
Declaration
protected virtual bool Equals(MediaReferenceBase other)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaReferenceBase | other | The MediaReferenceBase to compare with the current MediaReferenceBase. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the specified MediaReferenceBase is equal to the current MediaReferenceBase; otherwise, false. |
Equals(Object)
Determines whether the specified System.Object is equal to the current System.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 the specified System.Object is equal to the current System.Object; otherwise, false. |
Overrides
GetHashCode()
Serves as a hash function for a particular type.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for the current System.Object. |
Overrides
MakeReadOnly()
Makes the instance readonly.
Declaration
public void MakeReadOnly()
Parse<T>(JToken)
Parses a JObject to a MediaReferenceBase derived class.
Declaration
public static T Parse<T>(JToken jObject)
where T : MediaReferenceBase, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Newtonsoft.Json.Linq.JToken | jObject | The JObject to be parsed. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The type of instance to create |
Parse<T>(String)
Parses the supplied string and creates a matching instance
Declaration
public static T Parse<T>(string value)
where T : MediaReferenceBase, new()
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string representing the instance to create |
Returns
| Type | Description |
|---|---|
| T | The created instance |
Type Parameters
| Name | Description |
|---|---|
| T | The type of instance to create |
ThrowIfReadyOnly()
Throws an exception if the instance is readonly
Declaration
protected void ThrowIfReadyOnly()
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | If the MediaReferenceBase is read-only. |
ToString()
Returns a System.String that represents the current MediaReferenceBase.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents the current MediaReferenceBase. |
Overrides
Explicit Interface Implementations
IReadOnlyItem<MediaReferenceBase>.CreateWritableClone()
Creates a new object that is a copy of the current instance.
Declaration
MediaReferenceBase IReadOnlyItem<MediaReferenceBase>.CreateWritableClone()
Returns
| Type | Description |
|---|---|
| MediaReferenceBase | A new object that is a copy of this instance. |
Remarks
This clone is writable even if the original is readonly. It is also marked as not modified
ICloneable.Clone()
Creates a new object that is a copy of the current instance.
Declaration
object ICloneable.Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new object that is a copy of this instance. |