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.v18.1.dll
Declaration
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = true)]
public class FileAttachmentAttribute :
Attribute
Remarks
Use this attribute to activate the following Controllers that provide Actions to manage file attachments:
- FileAttachmentController (ASP.NET)
- FileAttachmentController (Windows Forms)
- FileAttachmentListViewController (Windows Forms)
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.
[FileAttachmentAttribute("File")]
public class MyFileAttachment : BaseObject {
// ...
private FileData file;
public FileData File {
get { return file; }
set { SetPropertyValue("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.
Note
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.