Mandatory Attributes

In this topic, you can learn about the mandatory attributes of data access class (DAC) fields and actions.

Mandatory Attributes of DAC Fields

For each field defined in a DAC, you must specify the following attributes:

  • A data type attribute, which is either a bound field data type attribute that binds the field to a database column of a particular data type, or an unbound field data type attribute that indicates that the field is unbound. At the same time, an unbound field data type attribute used along with the PXDBScalar or PXDBCalced attributes indicates that the field is bound to multiple table columns. For lists of these attributes, see Bound Field Data Types and Unbound Field Data Types.
  • The PXUIField attribute, which is mandatory for all fields that are displayed in the user interface. For details on the PXUIField attribute, see UI Field Configuration.

The example below demonstrates a declaration of a DAC field bound to a database column and displayed in the user interface.

// The data access class for the POReceiptFilter database table
[Serializable]
public partial class POReceiptFilter : PXBqlTable, IBqlTable
{
    ...
    // The type declaration of a DAC field
    public abstract class receiptType : PX.Data.IBqlField
    {
    }
    // The value declaration of a DAC field 
    // Put attributes before this declaration
    [PXDBString(2, IsFixed = true)]
    [PXUIField(DisplayName = "Type", Enabled = false)]
    public virtual String ReceiptType { get; set; }
    ...
}

Mandatory Attributes of Actions

A declaration of a method that implements an action in a business logic controller must be preceded with the PXButton attribute or one of its successors and the PXUIField attribute. For details on the PXUIField attribute, see UI Field Configuration.

The example below demonstrates a declaration of an action handler.

public PXAction<SalesOrder> ViewDocument;

[PXUIField(DisplayName = "View Document",
           MapEnableRights = PXCacheRights.Select,
           MapViewRights = PXCacheRights.Select)]
[PXButton]
public virtual IEnumerable viewDocument(PXAdapter adapter)
{
    ...
}