Back to Devexpress

IndexedAttribute.AdditionalFields Property

xpo-devexpress-dot-xpo-dot-indexedattribute.md

latest3.6 KB
Original Source

IndexedAttribute.AdditionalFields Property

Gets the names of additional columns that affect index creation.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public StringCollection AdditionalFields { get; }
vb
Public ReadOnly Property AdditionalFields As StringCollection

Property Value

TypeDescription
StringCollection

A collection of string values that specify the names of additional columns.

|

Remarks

XPO allows you to define a multi-column index in a persistent object.

Note

XPO does not support tables with multi-column (compound) keys or indexes in ASE databases. To avoid exceptions when connecting to ASE databases containing these tables, use one-column keys or indexes.

In the example below, the IndexedAttribute is applied to the LastName property. The names of other properties are specified as the first parameter (these names are delimited with semicolons). Finally, to make the value combination of these properties unique, the IndexedAttribute.Unique parameter is set to true.

csharp
using DevExpress.Xpo;

public class Person : XPObject {
    [Indexed("FirstName;BirthDate", Unique=true)]
    public string LastName {
        get { return fLastName; }
        set { SetPropertyValue(nameof(LastName), ref fLastName, value); }
    }
    string fLastName = string.Empty;

    public string FirstName {
        get { return fFirstName; }
        set { SetPropertyValue(nameof(FirstName), ref fFirstName, value); }
    }
    string fFirstName = string.Empty;

    public DateTime BirthDate {
        get { return fBirthDate; }
        set { SetPropertyValue(nameof(BirthDate), ref fBirthDate, value); }
    }
    DateTime fBirthDate;

}
vb
Imports DevExpress.Xpo

Public Class Person
    Inherits XPObject

    <Indexed("FirstName;BirthDate", Unique:=True)> _
    Public Property LastName() As String
        Get
            Return fLastName
        End Get
        Set(ByVal value as String)
            SetPropertyValue(NameOf(LastName), fLastName, value)
        End Set
    End Property
    Private fLastName As String = String.Empty

    Public Property FirstName() As String
        Get
            Return fFirstName
        End Get
        Set(ByVal value as String)
            SetPropertyValue(NameOf(FirstName), fFirstName, value)
        End Set
    End Property
    Private fFirstName As String = String.Empty

    Public Property BirthDate() As DateTime
        Get
            Return fBirthDate
        End Get
        Set(ByVal value as DateTime)
            SetPropertyValue(NameOf(BirthDate), fBirthDate, value)
        End Set
    End Property
    Private fBirthDate As DateTime

End Class

Note

Do not include the name of the Indexed attribute’s target field to the AdditionalFields list.

See Also

IndexedAttribute Class

IndexedAttribute Members

DevExpress.Xpo Namespace