Back to Devexpress

How to: Persist a BLOB Field

xpo-2059-examples-how-to-persist-a-blob-field.md

latest1.5 KB
Original Source

How to: Persist a BLOB Field

  • Aug 24, 2020

The following code example stores unstructured binary data in the Document property which is of the Byte array type.

csharp
public class Attachment: XPObject {
    public string Name {
        get { return fName; }
        set { SetPropertyValue(nameof(Name), ref fName, value); }
    }
    string fName;

    public Person Owner {
        get { return fOwner; }
        set { SetPropertyValue(nameof(Owner), ref fOwner, value); }
    }
    Person fOwner;

    public Byte[] Document;
}
vb
Public Class Attachment : Inherits XPObject
    Public Property Name() As String
        Get
            Return fName
        End Get
        Set(ByVal value as String)
            SetPropertyValue(NameOf(Name), fName, value)
        End Set
    End Property
    Private fName As String

    Public Property Owner() As Person
        Get
            Return fOwner
        End Get
        Set(ByVal value as Person)
            SetPropertyValue(NameOf(Owner), fOwner, value)
        End Set
    End Property
    Private fOwner As Person

    Public Property Document() As Byte
        Get
            Return fDocument
        End Get
        Set(ByVal value as Byte)
            SetPropertyValue(NameOf(Document), fDocument, value)
        End Set
    End Property
    Private fDocument As Byte
()
End Class

See Also

Delayed Loading