Share via


DbContextConfiguration 類別

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

DbContext 的 Configuration 方法所傳回,可為內容提供組態選項的存取。

繼承階層

System.Object
  System.Data.Entity.Infrastructure.DbContextConfiguration

命名空間:  System.Data.Entity.Infrastructure
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public Class DbContextConfiguration
'用途
Dim instance As DbContextConfiguration
public class DbContextConfiguration
public ref class DbContextConfiguration
type DbContextConfiguration =  class end
public class DbContextConfiguration

DbContextConfiguration 類型會公開下列成員。

屬性

  名稱 描述
公用屬性 AutoDetectChangesEnabled 取得或設定值,指出 DbContext 和相關類別的方法是否會自動呼叫 DetectChanges() 方法。預設值為 true。
公用屬性 EnsureTransactionsForFunctionsAndCommands 取得或設定值,以指定交易中是否一律要執行 SQL 函式及命令。
公用屬性 LazyLoadingEnabled 取得或設定值,指出公開為導覽屬性之關聯性的消極式載入是否已啟用。根據預設,會啟用消極式載入。
公用屬性 ProxyCreationEnabled 取得或設定值,指出每當此架構建立實體類型的執行個體時,它是否會建立動態產生之 Proxy 類別的執行個體。請注意,即使使用此旗標來啟用 Proxy 建立,也只會針對符合進行 Proxy 處理需求的實體類型來建立 Proxy 執行個體。預設會啟用 Proxy 建立。
公用屬性 UseDatabaseNullSemantics 取得或設定值,此值表示是否要在比較兩個可能為 null 的運算元時顯示資料庫 null 語意。預設值為 false。例如 (operand1 == operand2) 會分別轉譯為:(operand1 = operand2) (當 UseDatabaseNullSemantics 為 true 時;(((operand1 = operand2) AND (NOT (operand1 IS NULL OR operand2 IS NULL))) OR ((operand1 IS NULL) AND (operand2 IS NULL))) (當 UseDatabaseNullSemantics 為 false 時)。
公用屬性 ValidateOnSaveEnabled 取得或設定值,此值表示是否應在叫用 SaveChanges() 時自動驗證追蹤的實體。預設值為 true。

靠上

方法

  名稱 描述
公用方法 Equals 指定此組態是否與指定的物件相同。 (覆寫 Object.Equals(Object)。)
受保護的方法 Finalize (繼承自 Object)。
公用方法 GetHashCode 取得與此組態相關聯的雜湊碼。 (覆寫 Object.GetHashCode()。)
公用方法 GetType 取得目前執行個體的 Type
受保護的方法 MemberwiseClone (繼承自 Object)。
公用方法 ToString 傳回 DbContextConfiguration 的字串表示法。 (覆寫 Object.ToString()。)

靠上

執行緒安全

這個類型的任何 Public static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

System.Data.Entity.Infrastructure 命名空間