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.v19.1.dll

Declaration

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

Remarks

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.

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.

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.

Inheritance

Object
Attribute
IndexedAttribute
See Also