IDbContextFactory(TContext) Interface
Collapse the table of content
Expand the table of content

IDbContextFactory<TContext> Interface

Entity Framework 5.0

A factory for creating derived DbContext instances. Implement this interface to enable design-time services and instantiation for context types that do not have a public default constructor. You can create derived DbContext instances at design time to enable specific design-time experiences such as model rendering and DDL generation. Design-time services can auto-discover implementations of this interface that are in the same assembly as the derived DbContext type.

Namespace:  System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

public interface IDbContextFactory<out TContext>
where TContext : DbContext

Type Parameters

out TContext

This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see

The IDbContextFactory<TContext> type exposes the following members.

Public methodCreateCreates a new instance of a derived DbContext type.
© 2015 Microsoft