DbConfiguration.SetDefaultHistoryContext(Func<DbConnection,String,HistoryContext>) DbConfiguration.SetDefaultHistoryContext(Func<DbConnection,String,HistoryContext>) DbConfiguration.SetDefaultHistoryContext(Func<DbConnection,String,HistoryContext>) Method

Definition

Call this method from the constructor of a class derived from DbConfiguration to set a Func<T1,T2,TResult> delegate which which be used for creation of the default HistoryContext for a any DbMigrationsConfiguration. This default factory will only be used if no factory is set explicitly in the DbMigrationsConfiguration and if no factory has been registered for the provider in use using the SetHistoryContext(String, Func<DbConnection,String,HistoryContext>) method.

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))

Parameters

factory
Func<DbConnection,String,HistoryContext>

A factory for creating HistoryContext instances for a given DbConnection and String representing the default schema.

Remarks

This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver to add an appropriate resolver for Func<T1,T2,TResult>. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.

Applies to