开发者

Updating EF Model: tables missing

I have an entity framework (3.5) data model pointing to a remote SQL Server 2005 DB. I've added a few fields to a table in the DB, and wanted to update the model. It's my understanding that refreshing doesn't work and you have to remove and re-add the table, but when I removed it then went to "Update Model from Database", the table wasn't in the list!

If I add a NEW table to the 开发者_Go百科DB, it appears in the list, but if I try to remove and then re-add one, it's not there! I've done this a lot of times in other projects and I can't see why it isn't working with this one.

Any ideas?


If you open the Model Browser for the model there are two Sections, your Model and the Store. I know an issue we used to have was that an object would be deleted from the model but it's definition would still be in the store. At that point every time we updated EF would update the definition in the store but wouldn't regenerate the portion in the model, therefore it would look like it hadn't been imported at all (basically the quasi-existence it sounds like you're stuck in). Ensure it's deleted from both places through Visual Studio and then re-update, this should force EF to treat it as a new entity and generate the objects for both sections.

A second (and more painful) solution would be to open the XML file for the model and search for the entity names, then remove the matching objects. This is a little trickier and unfortunately it's been too long for me to be able to accurately give you instructions on how not to shoot yourself in the foot with it.


You should remove table from model in designer and than re add table.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜