A newer version of this page is available. Switch to the current version.

IndexedAttribute Class

Indicates that a property or field participates in index creation.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll


[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class IndexedAttribute :
<AttributeUsage(AttributeTargets.Property Or AttributeTargets.Field, Inherited:=True)>
Public NotInheritable Class IndexedAttribute
    Inherits Attribute


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;

    public string UserName;

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


See Also