简体   繁体   English

自动迁移如何在Entity Framework 4.3中内部工作

[英]How does automatic migrations work internally in Entity Framework 4.3

I want to know that how does automatic migrations work internally in Entity Framework 4.3 ? 我想知道自动迁移在Entity Framework 4.3中如何内部工作?

ie when i add a new property in my Model and Run the 'Update-Database' command in Package Manager Console then Code First Migrations will update my database and will include the new column(for the new property). 即,当我在模型中添加新属性并在Package Manager控制台中运行“ Update-Database”命令时,Code First Migrations将更新我的数据库,并将包括新列(用于新属性)。

Now i want to know how does 'Update-Database' command internally works ? 现在我想知道'Update-Database'命令在内部如何工作?

What do you want to know exactly? 您想确切知道什么?

If you run "Update-Database" and automatic migration is enabled for your DbContext, EF core compares current model with current Database schema and updates it if it would't cause any data loss. 如果您运行“ Update-Database”,并且为DbContext启用了自动迁移,则EF核心会将当前模型与当前数据库模式进行比较,并在不会造成任何数据丢失的情况下对其进行更新。 Otherwise you should specify -force key. 否则,您应指定-force键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM