Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

IndexedAttribute Class

Indicates that a property or field participates in index creation.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll


[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class IndexedAttribute :


The IndexedAttribute attribute indicates that a table (or another form of data store) will have an index for the column(s). An index allows a database to find data in a table without scanning the entire table. Indexes can be created on either a single property (column) or a combination of properties (columns). For more information on multi-column (compound) indexes, refer to the IndexedAttribute.AdditionalFields property description.


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.

For instance, you can apply the IndexedAttribute attribute to a persistent property to make it unique (see the example below):

public class User : XPObject {
    [Indexed(Unique = true)]
    public int UserId {
        get { return fUserId; }
        set { SetPropertyValue(nameof(UserId), ref fUserId, value); }
    int fUserId;

    public string UserName {
        get { return fUserName; }
        set { SetPropertyValue(nameof(UserName), ref fUserName, value); }
    string fUserName;


To define several non-unique database indices, use IndicesAttribute.


See Also