Table of Contents

Interface IDesignTimeDbContextFactory<TContext>

Namespace
Microsoft.EntityFrameworkCore.Design
Assembly
Microsoft.EntityFrameworkCore.dll

A factory for creating derived DbContext instances. Implement this interface to enable design-time services for context types that do not have a public default constructor. At design-time, derived DbContext instances can be created in order to enable specific design-time experiences such as Migrations. Design-time services will automatically discover implementations of this interface that are in the startup assembly or the same assembly as the derived context.

public interface IDesignTimeDbContextFactory<out TContext> where TContext : DbContext

Type Parameters

TContext

The type of the context.

Remarks

See Implementation of database providers and extensions for more information and examples.

Methods

CreateDbContext(string[])

Creates a new instance of a derived context.

TContext CreateDbContext(string[] args)

Parameters

args string[]

Arguments provided by the design-time service.

Returns

TContext

An instance of TContext.