DataField names are often shown in the user interface. For example, in a field's label,
a column title, or a validation error message. The actual column name is often not user friendly
and is certainly not localized.
DataFields can provide four different strings, localized if needed, when you use the
DESDA.DisplayNameAttribute and DESDA.DescriptionAttribute.
The DESDA.DisplayNameAttribute provides most used value, called "DisplayName". It also offers
a ShortDisplayName property where you can provide a smaller version of the text.
The DESDA.DescriptionAttribute provides text often used as a hint or tooltip called the "Description".
It also provides the Prompt property for text to show in a prompt within the user interface.
Here are some DESDA.DisplayNameAttribute and DESDA.DescriptionAttributes associated with the Product Entity class.
public class ProductMetadata
{
[DESDA.DisplayName("Product ID", ShortDisplayName="ID")]
public object ProductID { get; set; }
[DESDA.DisplayName("Product Name", ShortDisplayName="Name")]
[DESDA.Description("The product name.", Prompt="Enter the product name:")]
public object ProductName { get; set; }
[DESDA.DisplayName("Quantity Per Unit")]
public object QuantityPerUnit { get; set; }
[DESDA.DisplayName("Unit Price")]
[DESDA.Description("The price of one unit", Prompt="Enter the price for one unit")]
public object UnitPrice { get; set; }
}
The Source Code Browser shows completed DataAnnotations. The DESDA.DisplayNameAttribute and DESDA.DescriptionAttributes
have been highlighted.
In the next topic, you'll learn how to
supply defaults for DataFields when creating a new record.
Open the Source Code Browser (C# only)