且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

EF代码首先 - 如何设置身份种子?

更新时间:2023-02-07 13:18:33

如果您使用SQL Server,则必须创建自定义数据库初始化程序并手动执行 DBCC CHECKIDENT('TableName',RESEED,NewSeedValue)。要使用自定义SQL命令创建和使用自定义初始化程序,请检查此答案

If you are using SQL Server you must create custom database initializer and manually execute DBCC CHECKIDENT ('TableName', RESEED, NewSeedValue). For creating and using custom initializer with custom SQL commands check this answer.