DbContextActivator.CreateInstance 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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[]
傳遞至應用程式的引數。
傳回
新建立的物件。