Share via


DbContextActivator.CreateInstance Method

Definition

Overloads

CreateInstance(Type, Assembly, IOperationReportHandler)

Creates an instance of the specified DbContext type using the standard design-time mechanisms. When available, this will use any IDesignTimeDbContextFactory<TContext> implementations or the application's service provider.

CreateInstance(Type, Assembly, IOperationReportHandler, String[])

Creates an instance of the specified DbContext type using the standard design-time mechanisms. When available, this will use any IDesignTimeDbContextFactory<TContext> implementations or the application's service provider.

CreateInstance(Type, Assembly, IOperationReportHandler)

Creates an instance of the specified DbContext type using the standard design-time mechanisms. When available, this will use any IDesignTimeDbContextFactory<TContext> implementations or the application's service provider.

public static Microsoft.EntityFrameworkCore.DbContext CreateInstance (Type contextType, System.Reflection.Assembly startupAssembly = default, Microsoft.EntityFrameworkCore.Design.IOperationReportHandler reportHandler = default);
public static Microsoft.EntityFrameworkCore.DbContext CreateInstance (Type contextType, System.Reflection.Assembly? startupAssembly = default, Microsoft.EntityFrameworkCore.Design.IOperationReportHandler? reportHandler = default);
static member CreateInstance : Type * System.Reflection.Assembly * Microsoft.EntityFrameworkCore.Design.IOperationReportHandler -> Microsoft.EntityFrameworkCore.DbContext
Public Shared Function CreateInstance (contextType As Type, Optional startupAssembly As Assembly = Nothing, Optional reportHandler As IOperationReportHandler = Nothing) As DbContext

Parameters

contextType
Type

The DbContext type to instantiate.

startupAssembly
Assembly

The application's startup assembly.

reportHandler
IOperationReportHandler

The design-time report handler.

Returns

The newly created object.

Applies to

CreateInstance(Type, Assembly, IOperationReportHandler, String[])

Creates an instance of the specified DbContext type using the standard design-time mechanisms. When available, this will use any IDesignTimeDbContextFactory<TContext> implementations or the application's service provider.

public static Microsoft.EntityFrameworkCore.DbContext CreateInstance (Type contextType, System.Reflection.Assembly startupAssembly, Microsoft.EntityFrameworkCore.Design.IOperationReportHandler reportHandler, string[] args);
public static Microsoft.EntityFrameworkCore.DbContext CreateInstance (Type contextType, System.Reflection.Assembly? startupAssembly, Microsoft.EntityFrameworkCore.Design.IOperationReportHandler? reportHandler, string[]? args);
static member CreateInstance : Type * System.Reflection.Assembly * Microsoft.EntityFrameworkCore.Design.IOperationReportHandler * string[] -> Microsoft.EntityFrameworkCore.DbContext
Public Shared Function CreateInstance (contextType As Type, startupAssembly As Assembly, reportHandler As IOperationReportHandler, args As String()) As DbContext

Parameters

contextType
Type

The DbContext type to instantiate.

startupAssembly
Assembly

The application's startup assembly.

reportHandler
IOperationReportHandler

The design-time report handler.

args
String[]

Arguments passed to the application.

Returns

The newly created object.

Applies to