IReadOnlyModel 介面

定義

實體形狀、實體之間的關聯性,以及它們對應至資料庫的中繼資料。 模型通常是藉由覆 OnModelCreating(ModelBuilder) 寫衍生 DbContext 上的 方法所建立。

public interface IReadOnlyModel : Microsoft.EntityFrameworkCore.Infrastructure.IReadOnlyAnnotatable
type IReadOnlyModel = interface
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyModel
Implements IReadOnlyAnnotatable
衍生
實作

備註

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

屬性

Item[String]

取得具有指定名稱之注釋的值,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
ModelId

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

方法

AnnotationsToDebugString(Int32)

取得 物件上宣告之所有注釋的偵錯字串。

(繼承來源 IReadOnlyAnnotatable)
FindAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則傳 null 回 。

(繼承來源 IReadOnlyAnnotatable)
FindEntityType(String)

取得具有指定名稱的實體類型。 null如果找不到具有指定名稱的實體類型,或共用類型實體類型正在使用指定的 CLR 類型,或實體類型具有定義導覽,則傳回 。

FindEntityType(String, String, IReadOnlyEntityType)

取得指定基底名稱的實體類型,定義導覽名稱和定義實體類型。 如果找不到相符的實體類型,則傳 null 回 。

FindEntityType(Type)

取得對應指定實體類別的實體。 null如果找不到具有指定 CLR 類型的實體類型,或共用類型實體類型正在使用指定的 CLR 類型,或實體類型具有定義導覽,則傳回 。

FindEntityType(Type, String, IReadOnlyEntityType)

取得指定型別的實體類型,定義導覽名稱和定義實體類型。 如果找不到相符的實體類型,則傳 null 回 。

FindEntityTypes(Type)

取得符合指定型別的實體類型。

FindLeastDerivedEntityTypes(Type, Func<IReadOnlyEntityType,Boolean>)

傳回對應至指定中最小衍生型別的實體類型。

GetAnnotation(String)

取得具有指定名稱的注釋,如果不存在,則會擲回。

(繼承來源 IReadOnlyAnnotatable)
GetAnnotations()

取得目前 物件上的所有批註。

(繼承來源 IReadOnlyAnnotatable)
GetChangeTrackingStrategy()

取得用於模型中實體的預設變更追蹤策略。 此策略指出內容如何偵測實體類型實例的屬性變更。

GetEntityTypes()

取得模型中定義的所有實體類型。

GetProductVersion()

取得用來建置此模型的 EF Core 元件版本。

GetPropertyAccessMode()

PropertyAccessMode取得用於此模型中實體型別屬性的 。

IsShared(Type)

取得值,指出模型中的共用類型實體是否使用 CLR 類型。

ToDebugString(MetadataDebugStringOptions, Int32)

建立人類可讀取的指定中繼資料標記法。

警告:不要依賴傳回字串的格式。 它專為偵錯而設計,而且可能會在發行之間任意變更。

擴充方法

GetDefaultContainer(IReadOnlyModel)

傳回預設容器名稱。

GetThroughput(IReadOnlyModel)

傳回資料庫範圍中布建的輸送量。

FindDbFunction(IReadOnlyModel, MethodInfo)

尋找對應至指定 MethodInfo 所表示之方法的函式。

FindDbFunction(IReadOnlyModel, String)

尋找對應至指定名稱所表示之方法的函式。

FindSequence(IReadOnlyModel, String, String)

尋找具有指定名稱的序列。

GetCollation(IReadOnlyModel)

傳回資料庫定序。

GetDbFunctions(IReadOnlyModel)

傳回模型中包含的所有函式。

GetDefaultSchema(IReadOnlyModel)

傳回要用於模型的預設架構,如果沒有設定,則 null 傳回 。

GetMaxIdentifierLength(IReadOnlyModel)

傳回存放區識別碼允許的最大長度。

GetSequences(IReadOnlyModel)

傳回模型中包含的所有序列。

GetDatabaseMaxSize(IReadOnlyModel)

傳回資料庫的大小上限。

GetHiLoSequenceName(IReadOnlyModel)

傳回要用於預設 hi-lo 序列的名稱。

GetHiLoSequenceSchema(IReadOnlyModel)

傳回要用於預設 hi-lo 序列的架構。 UseHiLo(PropertyBuilder, String, String)

GetIdentityIncrement(IReadOnlyModel)

傳回預設識別遞增。

GetIdentitySeed(IReadOnlyModel)

傳回預設識別種子。

GetPerformanceLevelSql(IReadOnlyModel)

傳回資料庫的效能層級。

GetSequenceNameSuffix(IReadOnlyModel)

傳回要附加至自動建立序列名稱的尾碼。

GetSequenceSchema(IReadOnlyModel)

傳回要用於預設值產生序列的架構。 UseSequence(PropertyBuilder, String, String)

GetServiceTierSql(IReadOnlyModel)

傳回資料庫的服務層級。

GetValueGenerationStrategy(IReadOnlyModel)

SqlServerValueGenerationStrategy傳回 用於模型中索引鍵屬性的 ,除非屬性已明確設定策略。

適用於