Enitity Frame工作MVC代码首先从primairy键中删除auto auto [英] Enitity Frame work MVC code first remove auto incriment from primairy key
问题描述
我先创建了一个EF代码表,但是
遗憾的是我没有添加
Hi, I have created a table with EF code first but unfortunately I did not add the
[DatabaseGenerated(DatabaseGeneratedOption.None)]注释。因此会生成包含此主键的表格:
[DatabaseGenerated(DatabaseGeneratedOption.None)] annotation to it. so a table with this primary key is generated:
[ComplaintId]   BIGINT         IDENTITY(1,1)NOT NULL,
[ComplaintId] BIGINT IDENTITY (1, 1) NOT NULL,
所以我尝试将此作为非自动增量字段,并添加了数据注释 [DatabaseGenerated( DatabaseGeneratedOption.None)]到该字段并再次运行add-migration和Update-数据库。但没有任何变化。
so I try to get get this as a not auto increment field and I added the data annotation [DatabaseGenerated(DatabaseGeneratedOption.None)] to the field and ran the add-migration and Update- database again. but nothing changes.
有人知道怎么做吗?
谢谢。
Rob
Rob
推荐答案
什么?您不知道如何使用MS SQL Server Management Studio等数据库管理工具并执行此操作?
What? You don't know how to use a database administration tool like MS SQL Server Management Studio and do this?
这篇关于Enitity Frame工作MVC代码首先从primairy键中删除auto auto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!