語言

IDbContextFactory<TContext> 介面

定義

定義了建立 DbContext 實例的工廠。

public interface IDbContextFactory<TContext> where TContext : DbContext
public interface IDbContextFactory<out TContext> where TContext : DbContext
type IDbContextFactory<'Context (requires 'Context :> DbContext)> = interface
Public Interface IDbContextFactory(Of TContext)
Public Interface IDbContextFactory(Of Out TContext)

類型參數

TContext

那種 DbContext 會創造的人。

衍生

備註

更多資訊與範例請參閱 使用 DbContextFactory 。

方法

名稱 Description
CreateDbContext()

建立新的 DbContext 實例。

CreateDbContextAsync(CancellationToken)

在非同步上下文中建立一個新 DbContext 實例。

適用於