Skip to main content

ImageValueConverter.ConvertToStorageType(Object) Method

Converts the persistent property’s value to the specified type.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v21.2.dll


public override object ConvertToStorageType(
    object value


Name Type Description
value Object

An object which represents the value to convert.


Type Description

An object which represents the converted value. null (Nothing in Visual Basic) if the specified value is a null reference.


The ConvertToStorageType method converts the specified value to the type which is specified by the ImageValueConverter.StorageType property. If this method cannot convert the specified object to the destination type, it throws a NotSupportedException exception.


The following example shows how to convert the value of the Image property to an array of bytes when saving it in a data store.

using DevExpress.Xpo;

public class SampleImageClass : XPObject {
    private System.Drawing.Image image;
    public SampleImageClass(Session session) : base(session) {}

    public System.Drawing.Image Image {
        get { return image; }
        set {
            SetPropertyValue(nameof(Image) , ref image, value);
See Also