In EF, how does one add new fields and mappings to a table? ef Fields
First understand the ef generated model edmx code, portal: http://www.cnblogs.com/yushengbo/p/4807715.html
1. Add new fields
Let's use the current project as an example. First, create a field in the edmx table:
Then, set the attributes and content, right-click the table, and select display in the Model Browser to go to the Model Browser page:
Right-click the table and select generate database based on the model. In the pop-up box, click "finish". Then, add the corresponding fields to the object class and database table!
2. Add new link ing
To add a table relationship ing, the table must first have an object class. After my observation, this edmx has an object class, but the corresponding database table does not need to add a primary key, right-click any of the two tables that need to be mapped, select "New =" navigation property, right-click the "new property =" property, and modify the name and link. (Multiple factors are one-to-many, and the association selects the table to be associated)
Right-click the new navigation attribute and select table ing:
The ing relationship is displayed. The object key in the table to be associated is on the left, and the field to be associated with the table is selected on the right. If not, follow the steps to create a new one, but this field does not need to be updated to the database table in the Model Browser, that is, there is no need to complete the second step of heading 1, finally, you can add the new fields in the Table above in the corresponding table of the database. You do not need to add fields to the object class!