HistoryContext 构造函数
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
初始化 HistoryContext 类的新实例。 如果要创建派生历史记录上下文,通常将公开一个构造函数,接受这同样的这些参数,然后将它们传递给此基构造函数。
命名空间: System.Data.Entity.Migrations.History
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")> _
Public Sub New ( _
existingConnection As DbConnection, _
defaultSchema As String _
)
用法
Dim existingConnection As DbConnection
Dim defaultSchema As String
Dim instance As New HistoryContext(existingConnection, _
defaultSchema)
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public HistoryContext(
DbConnection existingConnection,
string defaultSchema
)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA2214:DoNotCallOverridableMethodsInConstructors")]
public:
HistoryContext(
DbConnection^ existingConnection,
String^ defaultSchema
)
[<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")>]
new :
existingConnection:DbConnection *
defaultSchema:string -> HistoryContext
public function HistoryContext(
existingConnection : DbConnection,
defaultSchema : String
)
参数
- existingConnection
类型:System.Data.Common.DbConnection
要用于新的上下文的现有连接。
- defaultSchema
类型:System.String
要迁移的模型的默认架构。 如果未在 OnModelCreating 中配置另一架构,则此架构将用于迁移历史记录表。