简体   繁体   中英

Setting the seed value for an identity column in visual studio/entity framework w/SQL Server 2008R2

Is it possible to override the seed value when creating a new table using the designer in visual studio?

I know it does not really matter from a programmatic point of view, but I don't like when ID's start at 1. I don't want to see customer ID of '1' or a sales order of 3 - I prefer them to all be the same length - ie 4 or 5 or 6 digits long, so depending on the estimate size of the data I always use 1,000, 10,000 or 100,000 as the starting seed value.

I know I can do it in SQL management studio, but even when I do set the seed to 1,000 or 10,000, if I refresh the EDMX from the database it reverts back to IDENTITY(1,1) and I don't want to have to do this for dozens of tables everytime I recreate the model. I can't find anything in the property window that would allow me to override this behavior.

Thanks.

Entity Designer数据库生成Power Pack将允许您更新数据库架构,而无需从头开始重新创建数据库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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