語言

HistoryContext.CacheKey 屬性

定義

取得用來定位先前為此情境建立的模型的金鑰。 此方法可避免每次建立新上下文實例時都處理 OnModelCreating 並計算模型。 預設情況下,此屬性會回傳預設結構。 大多數情況下,您不需要覆蓋此財產權。 不過,如果你的 OnModelCreating 實作包含條件邏輯,導致同一資料庫提供者和預設結構建立不同模型,你應該覆蓋這個屬性並計算出合適的鍵值。

public virtual string CacheKey { get; }
member this.CacheKey : string
Public Overridable ReadOnly Property CacheKey As String

屬性值

實作

適用於