1

I am about to begin a new project which will target an existing database with some existing tables with data. As part of my project, i will create some new tables and make relation ships with the existing tables ? Which approach is better in this scenario. I believe code first will be a problem because i don't want to loose my data every time when i make a change to the table structure (for my new table).

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Happy
  • 1,767
  • 6
  • 22
  • 26

1 Answers1

1

Model-first would be the easier solution. You would just create a model from the database and then you will update the database from the model after adding new entities.

You can achieve the same result with code-first too, but with a little extra work. You will need to use EF Migrations to add the new tables to your database. You can read more about EF Migrations here and here.

david.s
  • 11,283
  • 6
  • 50
  • 82