Specifies the property which is considered an analog of the GUID property, to allow use of more suitable values.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] public class FriendlyKeyPropertyAttribute : Attribute
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Interface)> Public Class FriendlyKeyPropertyAttribute Inherits Attribute
Normally, business classes have a persistent property which represents an identifier. This identifier is usually more suitable than a GUID. To inform the system of these identifier-like properties, apply the FriendlyKeyProperty attribute to a business class, and pass the identifier-like property as the FriendlyKeyPropertyAttribute.MemberName parameter. In XAF applications, the properties that use that attribute are involved in the following:
- Used in object caption format (see ObjectCaptionFormatAttribute).
- Displayed in List Views of Lookup Property Editors.
- Considered as the default property if there are no properties decorated with the DefaultProperty attribute (including inherited properties), or the business class does not declare a property that contains Name as its part (excluding inherited properties).
To add a column that corresponds to an identifier-like property to a Lookup List View, apply the FriendlyKey attribute in code.
In the example below, the FriendlyKeyProperty attribute is applied to the Contact class. As a result, the FullName property is considered as an identifier by the system.