语言

IndexAnnotation 类

定义

此类的实例用作自定义批注,用于表示 Entity Framework 模型中的数据库索引。

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

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

属性

名称 说明
Indexes

获取此批注表示的索引。

方法

名称 说明
IsCompatibleWith(Object)

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

MergeWith(Object)

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

ToString()

此类的实例用作自定义批注,用于表示 Entity Framework 模型中的数据库索引。

适用于