当前位置:网站首页>EF data migration
EF data migration
2022-07-24 16:30:00 【Weiwei became a father】
1. Tools ->NuGet Package manager -> Package manager console input enable-migrations( Open data migration )
There will be one more after the implementation 'Migrations' Folder , There will be 'Configuration.cs' The contents of the file settings are as follows :
public Configuration()
{
AutomaticMigrationsEnabled = true;// Indicates whether automatic migration values can be used when migrating databases
AutomaticMigrationDataLossAllowed = true;// Whether to accept the value of data loss during automatic migration
}2. stay CodeFrist Add a statement to the constructor in the context of
public Context()
: base("name=Context")
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<Context, Migrations.Configuration>("Context")); // Add this statement
}
Then move to other places ( It cannot be modified without migration ) You can update and modify the fields inside , Delete , After generation, the database will change
边栏推荐
- GEO satellite data download
- Stack and queue - 1047. Delete all adjacent duplicates in the string
- 【机器学习基础】——另一个视角解释SVM
- Wentai technology and Baoxin software deepened 5g cooperation, and 5g manufacturing settled in Baowu, China
- 1163: 松哥的分数拆分(C语言)
- 期盼已久全平台支持-开源IM项目OpenIM之uniapp更新
- Code shoe set - mt2095 · zigzag jump
- Unity 相机自由移动控制
- Unity camera free movement control
- leetcode:162. 寻找峰值【二分寻找峰值】
猜你喜欢
[email protected]"/>ZBar project introduction and installation configuration| [email protected]

城市安全系列科普丨进入溺水高发期,救生常识话你知

15、ARM嵌入式系统:如何用PC调试单板

287 finding duplicates

Caikeng Alibaba cloud Kex_ exchange_ identification: read: Connection reset by peer

Complete guide on how to prevent cross site scripting (XSS) attacks

Envi5.3 open GF-1 WFV data

Summary of experience in using.Net test framework xUnit, mstest, specflow

124 maximum path sum in binary tree

Servlet框架(servlet+jsp)+Mysql实现的增删改查+分页(功能包学生信息录入、学生信息增删改查、分页等)
随机推荐
Jupyter uses tips
Chapter 2 using API Mgmnt service
Servlet框架(servlet+jsp)+Mysql实现的增删改查+分页(功能包学生信息录入、学生信息增删改查、分页等)
TCP protocol debugging tool tcpengine v1.3.0 tutorial
File browser? QT can also be achieved!
1184. 公交站间的距离
解决Eureka默认缓存配置导致时效性问题
百度推广“删除重提”是什么意思?
124 maximum path sum in binary tree
Summary of experience in using.Net test framework xUnit, mstest, specflow
Qt设计仿真机器人控制器
Quickly view the version of redis in the server
15. ARM embedded system: how to debug single board with PC
Some understanding of the rank sum of matrix and the rank of image
Envi grid resampling
[leetcode]75. color classification - problem solving (execution time beat 90%, memory consumption beat 78%)
2019q1 global smartphone shipments: Huawei vivo increased significantly, while Apple plummeted 30.2%!
简易版QQ?Qt也可以实现!(一)
Druid integration shardingsphere appears xxmapper Reasons and solutions of XML error reporting
1163: 松哥的分数拆分(C语言)