IndexBuilder 類別

定義

提供簡單的 API 來設定 IMutableIndex

public class IndexBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>, Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalIndexBuilder>
public class IndexBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalIndexBuilder>
public class IndexBuilder : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionIndexBuilder>
type IndexBuilder = class
    interface IInfrastructure<IMutableModel>
    interface IInfrastructure<InternalIndexBuilder>
type IndexBuilder = class
    interface IInfrastructure<InternalIndexBuilder>
type IndexBuilder = class
    interface IInfrastructure<IConventionIndexBuilder>
Public Class IndexBuilder
Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalIndexBuilder)
Public Class IndexBuilder
Implements IInfrastructure(Of InternalIndexBuilder)
Public Class IndexBuilder
Implements IInfrastructure(Of IConventionIndexBuilder)
繼承
IndexBuilder
衍生
實作
IInfrastructure<IMutableModel> IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalIndexBuilder> IInfrastructure<IConventionIndexBuilder>

備註

使用 ModelBuilder API 時,這個類別的實例會從方法傳回,而且它不是設計成直接在應用程式程式碼中建構。

如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。

建構函式

IndexBuilder(IMutableIndex)

這是支援 Entity Framework Core 基礎結構的內部 API,不受與公用 API 相同的相容性標準。 它可能會在任何版本中變更或移除,而不會有任何通知。 您應該只在程式碼中直接使用它,並知道這麼做可能會導致應用程式在更新至新的 Entity Framework Core 版本時失敗。

IndexBuilder(InternalIndexBuilder)

此 API 支援 Entity Framework Core 基礎結構,並不適合直接從您的程式碼使用。 此 API 可能會在未來的版本中變更或移除。

屬性

Metadata

正在設定的索引。

方法

HasAnnotation(String, Object)

在索引上加入或更新注釋。 如果在 中指定索引鍵的注釋annotation 已經存在其值將會更新。

IsDescending(Boolean[])

設定此索引資料行的排序次序 () , (遞增或遞減) 。

IsUnique(Boolean)

設定此索引是否為唯一 (,也就是每個實例的值 (s) 必須是唯一的) 。

明確介面實作

IInfrastructure<IConventionIndexBuilder>.Instance

用來設定索引的內部產生器。

IInfrastructure<IMutableModel>.Instance

索引所屬的模型。

IInfrastructure<InternalIndexBuilder>.Instance

用來設定索引的內部產生器。

擴充方法

GetInfrastructure<T>(IInfrastructure<T>)

從使用 IInfrastructure<T> 隱藏的屬性取得值。

這個方法通常由資料庫提供者使用, (和其他延伸模組) 。 它通常不會用於應用程式程式碼中。

HasDatabaseName(IndexBuilder, String)

以關係資料庫為目標時,設定資料庫中的索引名稱。

HasFilter(IndexBuilder, String)

設定索引的篩選運算式。

HasName(IndexBuilder, String)
已過時。.

以關係資料庫為目標時,設定資料庫中的索引名稱。

ForSqliteHasName(IndexBuilder, String)

以 SQLite 為目標時,設定資料庫中的索引名稱。

ForSqlServerHasName(IndexBuilder, String)

以 SQL Server 為目標時,設定資料庫中的索引名稱。

ForSqlServerInclude(IndexBuilder, String[])
已過時。.

設定目標SQL Server時的索引包含屬性。

ForSqlServerIsClustered(IndexBuilder, Boolean)
已過時。.

設定以SQL Server為目標時,索引是否為叢集。

ForSqlServerIsCreatedOnline(IndexBuilder, Boolean)
已過時。.

設定以SQL Server為目標時,是否使用線上選項建立索引。

HasFillFactor(IndexBuilder, Int32)

設定以SQL Server為目標時,是否使用填滿因數選項建立索引。

IncludeProperties(IndexBuilder, String[])

設定目標SQL Server時的索引包含屬性。

IsClustered(IndexBuilder, Boolean)

設定以SQL Server為目標時,索引是否為叢集。

IsCreatedOnline(IndexBuilder, Boolean)

設定以SQL Server為目標時,是否使用線上選項建立索引。

SortInTempDb(IndexBuilder, Boolean)

設定目標為 SQL Server 時,是否以 tempdb 選項排序建立索引。

UseDataCompression(IndexBuilder, DataCompressionType)

設定以SQL Server為目標時,是否使用資料壓縮選項建立索引。

適用於