DbConfiguration.SetDefaultHistoryContext Method (Func<DbConnection, String, HistoryContext>)
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 method.
Assembly: EntityFramework (in EntityFramework.dll)
protected internal void SetDefaultHistoryContext( Func<DbConnection, string, HistoryContext> factory )
Parameters
- factory
-
Type:
System.Func<DbConnection, String, HistoryContext>
A factory for creating HistoryContext instances for a given DbConnection and String representing the default schema.
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.