語言

IndexAnnotation 類別

定義

此類別的實例被用作實體框架模型中資料庫索引的自訂註解。

public class IndexAnnotation : System.Data.Entity.Infrastructure.Annotations.IMergeableAnnotation
type IndexAnnotation = class
    interface IMergeableAnnotation
Public Class IndexAnnotation
Implements IMergeableAnnotation
繼承
IndexAnnotation
實作

備註

當 a IndexAttribute 被放置在該模型的映射屬性上時,會為 Code First 模型新增索引註解。 Entity Framework Migrations 會用此工具在映射的資料庫欄位上建立索引。 請注意,屬性上的多個索引屬性會合併成該欄的單一註解。 同樣地,多個屬性對應到同一欄位的索引屬性也會合併成該欄位的單一註解。 這表示一個索引標註可以代表多個索引。 在註解中,任何名稱只能有一個索引。

建構函式

名稱 Description
IndexAnnotation(IEnumerable<IndexAttribute>)

為給定的索引集合建立新的註解。

IndexAnnotation(IndexAttribute)

為給定索引建立新的註解。

欄位

名稱 Description
AnnotationName

當此註解儲存在 Entity Framework 元資料中或序列化成 SSDL/EDMX 檔案時所使用的名稱。

屬性

名稱 Description
Indexes

取得由此註解所代表的索引。

方法

名稱 Description
IsCompatibleWith(Object)

若此註解與給定註解不衝突,且可用該 MergeWith(Object) 方法將兩者結合,則返回為真。

MergeWith(Object)

將此註解與給定註解合併,並回傳包含合併索引的新註解。

ToString()

此類別的實例被用作實體框架模型中資料庫索引的自訂註解。

適用於