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

IndicesAttribute Class

Specifies the properties that participate in creation of non-unique database indices.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll


[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public sealed class IndicesAttribute :
<AttributeUsage(AttributeTargets.Class, Inherited:=True)>
Public NotInheritable Class IndicesAttribute
    Inherits Attribute


Apply this attribute to a persistent class to specify database indices to be created in the database table associated with the class. Unlike IndexedAttribute, IndicesAttribute allows you to specify several non-unique indices for the current table using a single attribute declaration. The following code snippet illustrates usage of both attributes.

[Indices("Name", "Name;Age", "Age;ChildCount")]
public class Person : XPObject {
    public String Name;
    [Indexed(Unique = true), Size(64)]
    public String FullName;
    public int Age;
    public int ChildCount;

With this code in place, the database table corresponding to Person will have four indices.

  1. A non-unique index over the Name column.
  2. A non-unique multi-column index over the Name and Age columns.
  3. A non-unique multi-column index over the Age and ChildCount columns.
  4. A unique index over the FullName column.

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.


See Also