I have a web-app that uses EF5. I have two tables that are my main concern. I have a members table and a claims table. I have false members that I need for testing purposes and this saves their claims to the claims table.
There is real data in these tables as well that I do not want to change. Some of the false members are missing different data or need specific things to process said claim. How do repopulate my false members exactly as I want them without dropping the database.
I have looked into Code First Migrations on http://www.pluralsight.com but I am not sure how to tell it to always seed the 10 false members and remove the new claims from the claims table. Some of the members have past claims so I only wanna remove the ones that get added during testing.
Anyone have any suggestions?
This has nothing to do with migrations. Migrations seeds data only when your migration is executed = when something changes in your class structure and database needs to be modified as well. You just need to call your initialization logic from
Application_Startbut you should make it conditionally complied – I guess such code should not get into production version.