C#C
C#2y ago
Joellao

EF Migrations 101

Hello everyone.
I'm starting a new project and wanted to know why the hell are the migrations so hard to work with. I have the Database entities and a working state of the current implementation. If I need to create a new entity with some relationship it fucks up everything.

The new migration is not updating the db, or it updates the DB but then it complains when inserting data that foreign key constraint is going nuts.

Do you have a preferred way on how to work with this, because deleting all the migration folder and creating a new migration each time I need to add some relationship, doesn't seem the way to deal with this.

Do you guys also set the relationships in the OnModelCreating or you just let ef handle that?

Question and ranting at the same time, sorry for that
Was this page helpful?