I am converting an application to use the code first approach. My tables have hundreds of records and I do not want to write the seed statements by hand. Has anyone written a T4 template that will generate the statements that go into the DbContext seed method? The tables need to be seeded so that the foreign key tables are populated after the parent tables. Thanks!
Share
I made the switch from the database first approach to the code first approach. I wanted to be able to repopulate the database when it was dropped due to a POCO change. What I ended up doing was developing another small project to transfer data. The data transfer project has two EDMXs: One that points to a backup copy of the old database and another that points to the new database. I iterate over the entities in the backup DB and create new entities in the new DB. This is not the most elegant solution but it meets the needs for this project.