次の方法で共有


DbConfiguration.SetHistoryContext メソッド

定義

から派生したDbConfigurationクラスのコンストラクターからこのメソッドを呼び出してデリゲートをFunc<T1,T2,TResult>設定します。これにより、明示的なファクトリ セットを持たない任意DbMigrationsConfigurationのプロバイダーに対して、指定されたプロバイダー用にカスタマイズされた HistoryContext を作成できます。

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

パラメーター

providerInvariantName
String

このジェネレーターを使用する必要がある ADO.NET プロバイダーの不変名。

factory
Func<DbConnection,String,HistoryContext>

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

注釈

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

適用対象