Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IDbContextFactory<TContext>.CreateDbContext Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.dll
Package:
Microsoft.EntityFrameworkCore v10.0.0
Package:
Microsoft.EntityFrameworkCore v5.0.0
Package:
Microsoft.EntityFrameworkCore v6.0.0
Package:
Microsoft.EntityFrameworkCore v7.0.0
Package:
Microsoft.EntityFrameworkCore v8.0.0
Package:
Microsoft.EntityFrameworkCore v9.0.0
Source:
IDbContextFactory.cs
Source:
IDbContextFactory.cs
Source:
IDbContextFactory.cs
Source:
IDbContextFactory.cs
Source:
IDbContextFactory.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Creates a new DbContext instance.

public TContext CreateDbContext();
abstract member CreateDbContext : unit -> 'Context
Public Function CreateDbContext () As TContext

Returns

TContext

A new context instance.

Remarks

The caller is responsible for disposing the context; it will not be disposed by any dependency injection container.

Applies to


Feedback

Was this page helpful?