IndexAnnotation 类

定义

此类的实例用作自定义注释,用于表示实体框架模型中的数据库索引。

public class IndexAnnotation : System.Data.Entity.Infrastructure.Annotations.IMergeableAnnotation
type IndexAnnotation = class
    interface IMergeableAnnotation
Public Class IndexAnnotation
Implements IMergeableAnnotation
继承
IndexAnnotation
实现

注解

将 放在该模型的映射属性上时 IndexAttribute ,将索引批注添加到 Code First 模型。 实体框架迁移使用此函数在映射的数据库列上创建索引。 请注意,属性上的多个索引属性将合并为列的单个批注。 同样,映射到同一列的多个属性上的索引属性将合并为该列的单个注释。 这意味着一个索引批注可以表示多个索引。 在批注中,只能有一个具有任何给定名称的索引。

构造函数

IndexAnnotation(IEnumerable<IndexAttribute>)

为给定索引集合创建一个新批注。

IndexAnnotation(IndexAttribute)

为给定索引创建一个新批注。

字段

AnnotationName

此批注存储在实体框架元数据中或序列化为 SSDL/EDMX 文件时使用的名称。

属性

Indexes

获取由此注释表示的索引。

方法

IsCompatibleWith(Object)

如果此批注不与给定批注冲突,因此可以使用 方法将两者组合在一起 MergeWith(Object) ,则返回 true。

MergeWith(Object)

将此批注与给定批注合并,并返回包含合并索引的新批注。

ToString()

此类的实例用作自定义注释,用于表示实体框架模型中的数据库索引。

适用于