IndexAttribute Class

Definition

Specifies an index to be generated in the database.

C#
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)]
public sealed class IndexAttribute : Attribute
Inheritance
IndexAttribute
Attributes

Remarks

See Modeling entity types and relationships for more information and examples.

Constructors

IndexAttribute(String, String[])

Initializes a new instance of the IndexAttribute class.

IndexAttribute(String[])
Obsolete.

Initializes a new instance of the IndexAttribute class.

Properties

AllDescending

Whether all index columns have descending sort order.

IsDescending

A set of values indicating whether each corresponding index column has descending sort order.

IsUnique

Whether the index is unique.

IsUniqueHasValue

Checks whether IsUnique has been explicitly set to a value.

Name

The name of the index.

PropertyNames

The properties which constitute the index, in order.

Applies to

Product Versions
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0