Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 23, 2012 02:56 PM by mpop
Nov 23, 2012 01:21 AM|LINK
I just finished creating a new website using code first - MVC 4. The user asks now for a new field in a table. I couldn't find an easy way to implement this. I changed the model to include the new field but I get the an error.
Any idea on how I can do this without droping and recreating the table ?
Nov 23, 2012 06:00 AM|LINK
Some nice articles for your problem
Nov 23, 2012 06:41 AM|LINK
alter table add column
or search for
ef code migration
Nov 23, 2012 10:44 AM|LINK
If you need to Add new Column in Table so do Following Stap.
Add Column in Table
Update your Edmx File in Visual Studio. open Edmx and right Click and Click on "Update Model From DataBase" so it is Add one Column in Your Edmx.
now you need to Change You Code as per Requirment. for inser update and Select.
Nov 23, 2012 01:58 PM|LINK
Thank you for your answer,
This is exactly what I did, I made changes to the table, changes to my model classes, but no EDMX file, I'm using SQL Server 2008 not the Express version.
Nov 23, 2012 02:56 PM|LINK
At the end I did it thru "Package Manager Console" but I'm still looking if there is another way to simple change the model class when DB is changing.