DbContextActivator.CreateInstance 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| CreateInstance(Type, Assembly, IOperationReportHandler) |
使用標準設計時機制建立指定 DbContext 類型的實例。 若有,該系統將使用任何 IDesignTimeDbContextFactory<TContext> 實作或應用程式的服務提供者。 |
| CreateInstance(Type, Assembly, IOperationReportHandler, String[]) |
使用標準設計時機制建立指定 DbContext 類型的實例。 若有,該系統將使用任何 IDesignTimeDbContextFactory<TContext> 實作或應用程式的服務提供者。 |
CreateInstance(Type, Assembly, IOperationReportHandler)
使用標準設計時機制建立指定 DbContext 類型的實例。 若有,該系統將使用任何 IDesignTimeDbContextFactory<TContext> 實作或應用程式的服務提供者。
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
參數
- startupAssembly
- Assembly
應用程式的啟動組件。
- reportHandler
- IOperationReportHandler
設計時報告處理器。
傳回
新創造的物品。
適用於
CreateInstance(Type, Assembly, IOperationReportHandler, String[])
使用標準設計時機制建立指定 DbContext 類型的實例。 若有,該系統將使用任何 IDesignTimeDbContextFactory<TContext> 實作或應用程式的服務提供者。
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
參數
- startupAssembly
- Assembly
應用程式的啟動組件。
- reportHandler
- IOperationReportHandler
設計時報告處理器。
- args
- String[]
傳遞至應用程式的參數。
傳回
新創造的物品。