Skip to main content

ImageValueConverter.ConvertFromStorageType(Object) Method

Converts a stored value from the ImageValueConverter.StorageType to its persistent property type.

Namespace: DevExpress.Xpo.Metadata

Assembly: DevExpress.Xpo.v24.2.dll

NuGet Package: DevExpress.Xpo

#Declaration

public override object ConvertFromStorageType(
    object value
)

#Parameters

Name Type Description
value Object

An object which represents the value to convert.

#Returns

Type Description
Object

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

#Remarks

The ConvertFromStorageType method returns a value which is converted from the ImageValueConverter.StorageType to the type of persistent property it represents.

#Example

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) {}

    [ValueConverter(typeof(DevExpress.Xpo.Metadata.ImageValueConverter))]
    public System.Drawing.Image Image {
        get { return image; }
        set {
            SetPropertyValue(nameof(Image) , ref image, value);
        }
    }
}
See Also