Language

DbConfiguration.SetDefaultHistoryContext メソッド

定義

DbConfigurationから派生したクラスのコンストラクターからこのメソッドを呼び出して、任意のDbMigrationsConfigurationの既定のHistoryContextの作成に使用するFunc<T1,T2,TResult> デリゲートを設定します。 この既定のファクトリは、 DbMigrationsConfiguration でファクトリが明示的に設定されていない場合、および SetHistoryContext(String, Func<DbConnection,String,HistoryContext>) メソッドを使用して使用中のプロバイダーにファクトリが登録されていない場合にのみ使用されます。

protected internal void SetDefaultHistoryContext(Func<System.Data.Common.DbConnection,string,System.Data.Entity.Migrations.History.HistoryContext> factory);
member this.SetDefaultHistoryContext : Func<System.Data.Common.DbConnection, string, System.Data.Entity.Migrations.History.HistoryContext> -> unit
Protected Friend Sub SetDefaultHistoryContext (factory As Func(Of DbConnection, String, HistoryContext))

パラメーター

factory
Func<DbConnection,String,HistoryContext>

特定のDbConnectionHistoryContextインスタンスを作成し、既定のスキーマを表すStringファクトリ。

注釈

このメソッドは、Entity Framework に構成を追加するための便利で検出可能な方法として提供されます。 内部的には、AddDependencyResolver を使用して Func<T1,T2,TResult>に適切なリゾルバーを追加するのと同じ方法で動作します。 これは、必要に応じて、制御の反転コンテナーによってサポートされるカスタム 競合回避モジュールまたはリゾルバーを使用して同じ機能を実現できることを意味します。

適用対象