问题
I am using entity framework 4.0 my approach is Database first approach. what is the best way to rename a column name or change the data type of column in edmx.
thanks in advance.
回答1:
To rename a column:
- Rename the column in SQL Management Studio.
- In the EDMX editor, choose "Update from Database", and complete the wizard. You will get a new column with the updated name, and an error-message saying that the old column is not mapped.
- Remove the old column.
To change the datatype:
- Update the datatype in SQL Management Studio.
- In the EDMX editor, choose "Update from Database", and complete the wizard. You will get an error message saying that the mapping is invalid.
- Change the datatype of the column to match what you chose in SQL Management Studio.
来源:https://stackoverflow.com/questions/16535313/what-is-the-best-way-to-re-name-a-column-in-edmx