IndexAttribute 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当此属性放置在属性上时,它指示该属性映射到的数据库列具有索引。
[System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=true)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
public class IndexAttribute : Attributetype IndexAttribute = class
    inherit AttributePublic Class IndexAttribute
Inherits Attribute- 继承
- 
				IndexAttribute
- 属性
注解
实体框架迁移使用此属性在映射的数据库列上创建索引。 多列索引是在多个属性中使用同一索引名称创建的。 然后,将这些属性中的信息合并在一起以指定实际的数据库索引。
构造函数
| IndexAttribute() | IndexAttribute为将按约定命名且未指定列顺序、聚类分析或唯一性的索引创建实例。 | 
| IndexAttribute(String) | IndexAttribute为具有给定名称且未指定列顺序、聚类分析或唯一性的索引创建实例。 | 
| IndexAttribute(String, Int32) | IndexAttribute为具有给定名称和列顺序但未指定聚类分析或唯一性的索引创建实例。 | 
属性
| IsClustered | 将此属性设置为 true 可定义聚集索引。 将此属性设置为 false 以定义非聚集索引。 | 
| IsClusteredConfigured | 如果已设置为值,则 IsClustered 返回 true。 | 
| IsUnique | 将此属性设置为 true 以定义唯一索引。 将此属性设置为 false 可定义非唯一索引。 | 
| IsUniqueConfigured | 如果已设置为值,则 IsUnique 返回 true。 | 
| Name | 索引名称。 | 
| Order | 一个数字,用于确定多列索引的列顺序。 如果未指定列顺序,则为 -1。 | 
| TypeId | 为每个对象实例返回不同的 ID,以便类型描述符不会尝试将所有 IndexAttribute 实例合并到单个实例中。 | 
方法
| Equals(IndexAttribute) | 如果此属性指定与给定属性相同的名称和配置,则返回 true。 | 
| Equals(Object) | 如果此属性指定与给定属性相同的名称和配置,则返回 true。 | 
| GetHashCode() | 当此属性放置在属性上时,它指示该属性映射到的数据库列具有索引。 | 
| ToString() | 当此属性放置在属性上时,它指示该属性映射到的数据库列具有索引。 |