Class Media
Represents a Media object
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
[Serializable]
[DataContract(IsReference = true)]
public class Media : ContentBase, IMedia, IContentBase, IUmbracoEntity, IAggregateRoot, IDeletableEntity, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty
Constructors
Media(String, Int32, IMediaType)
Constructor for creating a Media object
Declaration
public Media(string name, int parentId, IMediaType contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | ame of the Media object |
System.Int32 | parentId | Id of the Parent IMedia |
IMediaType | contentType | MediaType for the current Media object |
Media(String, Int32, IMediaType, PropertyCollection)
Constructor for creating a Media object
Declaration
public Media(string name, int parentId, IMediaType contentType, PropertyCollection properties)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Media object |
System.Int32 | parentId | Id of the Parent IMedia |
IMediaType | contentType | MediaType for the current Media object |
PropertyCollection | properties | Collection of properties |
Media(String, IMedia, IMediaType)
Constructor for creating a Media object
Declaration
public Media(string name, IMedia parent, IMediaType contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | ame of the Media object |
IMedia | parent | Parent IMedia object |
IMediaType | contentType | MediaType for the current Media object |
Media(String, IMedia, IMediaType, PropertyCollection)
Constructor for creating a Media object
Declaration
public Media(string name, IMedia parent, IMediaType contentType, PropertyCollection properties)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | ame of the Media object |
IMedia | parent | Parent IMedia object |
IMediaType | contentType | MediaType for the current Media object |
PropertyCollection | properties | Collection of properties |
Properties
ContentType
Gets the ContentType used by this Media object
Declaration
[IgnoreDataMember]
public IMediaType ContentType { get; }
Property Value
Type | Description |
---|---|
IMediaType |
Methods
ChangeContentType(IMediaType)
Changes the IMediaType for the current Media object
Declaration
public void ChangeContentType(IMediaType contentType)
Parameters
Type | Name | Description |
---|---|---|
IMediaType | contentType | New MediaType for this Media |
Remarks
Leaves PropertyTypes intact after change
ChangeContentType(IMediaType, Boolean)
Changes the IMediaType for the current Media object and removes PropertyTypes, which are not part of the new MediaType.
Declaration
public void ChangeContentType(IMediaType contentType, bool clearProperties)
Parameters
Type | Name | Description |
---|---|---|
IMediaType | contentType | New MediaType for this Media |
System.Boolean | clearProperties | Boolean indicating whether to clear PropertyTypes upon change |
ChangeTrashedState(Boolean, Int32)
Changes the Trashed state of the content object
Declaration
public override void ChangeTrashedState(bool isTrashed, int parentId = -20)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isTrashed | Boolean indicating whether content is trashed (true) or not trashed (false) |
System.Int32 | parentId |