开发者

Added a field to a table in the database - how to make Entity edmx respond?

I tried rebuilding but it seems that the edmx file doesn't update itself with the changes I made. Any suggestions besides removing the edmx and remaki开发者_StackOverflow中文版ng it?


If you are using Entity Framework 4.0 you can just right-click the white-space in the designer, choose 'Update Model from Database' and hit Finish. This will refresh all tables.


You can add the field manually. It's not so hard, especially if it's a scalar.

  1. Make sure your existing model is checked in in case you have to roll back!
  2. Note the name of some other scalar column in the table, preferably one with a unique name and the same type.
  3. Right click model, "Open With", XML Editor.
  4. Search for the other field.
  5. Add the new field everywhere the other field pops up. There will be at least three different places to change. But note that the field may already be in the SSDL/storage schema, which would be why it didn't add in the first place.
  6. Look at the Errors pane to make sure you haven't messed up the XML validity.
  7. Save and compile.

Now you can edit the new field in the GUI by re-opening the model, if need be.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜