Back to Devexpress

MediaDataObject Class

expressappframework-devexpress-dot-persistent-dot-baseimpl.md

latest3.3 KB
Original Source

MediaDataObject Class

The XPO persistent class used to store media data in the database.

Namespace : DevExpress.Persistent.BaseImpl

Assembly : DevExpress.Persistent.BaseImpl.Xpo.v25.2.dll

NuGet Package : DevExpress.Persistent.BaseImpl.Xpo

Declaration

csharp
[Browsable(false)]
[EditorAlias("ImagePropertyEditor")]
[MediaDataObject("MediaDataKey", "MediaData", "MediaData")]
public class MediaDataObject :
    BaseObject,
    IEmptyCheckable
vb
<MediaDataObject("MediaDataKey", "MediaData", "MediaData")>
<Browsable(False)>
<EditorAlias("ImagePropertyEditor")>
Public Class MediaDataObject
    Inherits BaseObject
    Implements IEmptyCheckable

Remarks

You can use the MediaDataObject type to declare a reference property of a business class that is used to store and display an image.

WinForms and ASP.NET Core Blazor Image Property Editors are used automatically for properties of the MediaDataObject type.

You can find an example in the BLOB Image Properties in XPO topic.

MediaDataObject is a container for two values:

  • MediaDataObject.MediaData A byte array object that is loaded from a database on demand when required. It is not loaded together with the MediaDataObject itself and may contain any type of media.
  • MediaDataObject.MediaDataKey A key value of the string type. This value should not be changed from your code. It is updated automatically when the MediaData byte array is changed and is unique for each MediaDataObject. MediaDataKey is used in a URL of the MediaData loaded by a browser. The URL is generated under the following conditions.

The Winforms and Blazor editors ( ImagePropertyEditor ) support the MediaDataObject property type partially - they use MediaData only, and do not provide caching.

Note

It is not recommend to change the MediaData value by direct database queries. In this instance, the URL will not change, and it will be required to manually refresh the page to see the changes.

Implements

IEmptyCheckable

Inheritance

Object PersistentBase XPBaseObject XPCustomObject BaseObject MediaDataObject

See Also

MediaDataObject Members

DevExpress.Persistent.BaseImpl Namespace