Back to Devexpress

XPClassInfo.KeyProperty Property

xpo-devexpress-dot-xpo-dot-metadata-dot-xpclassinfo-359be16c.md

latest2.8 KB
Original Source

XPClassInfo.KeyProperty Property

Gets information on the key property or key field.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public XPMemberInfo KeyProperty { get; }
vb
Public ReadOnly Property KeyProperty As XPMemberInfo

Property Value

TypeDescription
XPMemberInfo

An XPMemberInfo object which provides information about the key property or key field. If null ( Nothing in Visual Basic) a KeyPropertyAbsentException is thrown.

|

Remarks

Use this property to retrieve information on the member which provides key values for unique identification of the persistent objects within the collection.

See the Microsoft .NET Framework Documentation and Microsoft SQL Server Guide in order to learn more about relational databases.

The following code snippets (auto-collected from DevExpress Examples) contain references to the KeyProperty property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

XPO_how-to-implement-odata4-service-with-xpo-netcore/CS/ODataService/Models/SingletonEdmModel.cs#L66

csharp
} else {
    if(classInfo.KeyProperty is ReflectionFieldInfo) {
        foreach(XPMemberInfo mi in classInfo.Members) {

XPO_how-to-implement-odata4-service-with-xpo/CS/ODataService/App_Start/WebApiConfig.cs#L79

csharp
} else {
    if(classInfo.KeyProperty is ReflectionFieldInfo) {
        foreach(XPMemberInfo mi in classInfo.Members) {

See Also

XPClassInfo Class

XPClassInfo Members

DevExpress.Xpo.Metadata Namespace