.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

FriendlyKeyPropertyAttribute Class

Specifies the property which is considered an analog of the GUID property, to allow use of more suitable values.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class FriendlyKeyPropertyAttribute :
    Attribute
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Interface)>
Public Class FriendlyKeyPropertyAttribute
    Inherits Attribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class FriendlyKeyPropertyAttribute :
    Attribute
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Interface)>
Public Class FriendlyKeyPropertyAttribute
    Inherits Attribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class FriendlyKeyPropertyAttribute :
    Attribute
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Interface)>
Public Class FriendlyKeyPropertyAttribute
    Inherits Attribute

Remarks

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).

The name of the property passed as the FriendlyKeyProperty attribute's parameter is set for the IModelClass.FriendlyKeyProperty property of the Application Model's BOModel | <Class> node.

Note

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.

[FriendlyKeyProperty(nameof(FullName))]
public class Contact : Person {
   //...
}

Inheritance

Object
Attribute
FriendlyKeyPropertyAttribute
See Also