I am developing an utility that transfers the data from one structure into another data structure which is then stored in a SQl Server database controlled by Entity-Framework.
Each time I change the target database model I am doing the following;
- Deleting the data from the target database.
- Running "dbcc checkident("table", reseed)" on each table (many tables) to reset the ID values.
- Reseeding the Database using "update-database"
After reading the following http://www.entityframeworktutorial.net/code-first/database-initialization-strategy-in-code-first.aspx I think I have two options. I don't think I want to roll my own initialiser.
The first option is to use one of the drop create strategies during development , (dropCreateifmodelChanges, or DropCreateAlways) Will the Drop Create process delete the existing target data, and reseed the Identity counter?
The second option is to somehow include the deletion, and the ID reset in the seed function. Can this be done? If so - how?
Is there a better option? Does anyone have any advice?