简体   繁体   English

如何通过在 Id(主要)上使用迁移来启用(ON)自动递增(1,1)? C#.NET(MVC)

[英]How to Enable(ON) Auto-increment (1,1) by using Migration on Id (primary) ? C#.NET(MVC)

I Have tried the following codes Add-Migration EnableAutoIncerementToStudent.我尝试了以下代码 Add-Migration EnableAutoIncerementToStudent。

but that code show no change in database.但该代码显示数据库没有变化。

Any help will be appreciate.任何帮助将不胜感激。

You may use capital id - "ID" instead of just "id" which works perfectly for me.您可以使用大写 id - “ID” 而不仅仅是“id”,这对我来说是完美的。 Otherwise, edit your table from the DB and alter the table with identity(1,1) in front of the id column.否则,从数据库编辑您的表并在 id 列前面使用identity(1,1)更改表。

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

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