John Mayer
John Mayer

Reputation: 3363

How to return EF database to default?

Basically I'm developing an ASP.NET MVC 4 application using EF code first. Now; during my testing I've inserted a lot of annoying rows in my database.

How can I revert back to the initial seed data, discarding all other rows?

Upvotes: 2

Views: 229

Answers (2)

VahidN
VahidN

Reputation: 19156

If you don't want all of the records, just drop the database. EF Code first will create a new one on the next run. more info

Upvotes: 2

C0L.PAN1C
C0L.PAN1C

Reputation: 12243

Manually delete the rows from your database. you can reset your ID/Primary key seed with (in SQL Server)

 DBCC CHECKIDENT(YourTableName, RESEED, 0)

in your SQL command console from Enterprise Manager/SQL Studio.

Upvotes: 0

Related Questions