Updating MVC Model From Database

634 Views Asked by At

I am still new to EF and MVC and how they work together so excuse my ignorance. I have a SQL DB that I generated the MVC Data Model from and I have recently added some fields to a couple tables and now I need to update those changes from my SQL DB into my Model1.edmx.

The issue is that when I went to update the Model from my DB, the update overwrote all of my [Display(Name = "DisplayName")] and [Required] for each field.

So, my question is this: Is there a way to maintain all of my current changes to the Model and just bring in the new fields without overwriting every table in the Model?


Edit: I have tried this: Add data annotations to a class generated by entity framework but to no success. Whenever I regenerate the Model from the database it just overwrites whatever classes I had there. I am creating a public class just like in the example but it gets wiped when I update the Model. Any ideas?


Any help would be awesome! Thanks!

0

There are 0 best solutions below