Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

FileAttachmentAttribute Class

Applied to business classes that expose a property of the IFileData type. Activates Controllers that manage file attachments for the target business class. Specifies a property that stores a file attachment.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.Persistent.Base.v20.2.dll


[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = true)]
public class FileAttachmentAttribute :


Use this attribute to activate the following Controllers that provide Actions to manage file attachments:

The FileAttachmentAttribute attribute takes a single parameter - the FileAttachmentAttribute.FileDataPropertyName. The parameter specifies the property of a IFileData type to be used by the Controllers listed above. The snippet below illustrate the FileAttachmentAttribute attribute usage.

public class MyFileAttachment : BaseObject {
    // ...
    private FileData file;
    public FileData File {
        get { return file; }
        set { SetPropertyValue(nameof(File), ref file, value); }
public class FileData : BaseObject, IFileData {
   // ...

As an alternative to using the FileAttachmentAttribute, you can inherit from the FileAttachmentBase class. It has the FileAttachmentAttribute applied, and exposes the File property to store file attachments.


It is not recommended to use the DataView mode with the FileAttachmentAttribute. In this mode, a separate request to database is made for each focused List View record.


See Also