开发者

Entity Framework: deleted SQL table is not removed from the model

开发者 https://www.devze.com 2023-03-13 01:27 出处:网络
Seemingly simple thing got me completely frozen and I can\'t find anything on the Net about this: I had a common many to many relationship in my db:

Seemingly simple thing got me completely frozen and I can't find anything on the Net about this:

I had a common many to many relationship in my db:

Table One + TableTwo + LinkingTable with 2 columns: TableOneID and TableTwoID

I deleted the LinkingTable and tried to update the model from database. Now I get error "Error 11007: Entity type 'LinkingTable' is not mapped."

Does anyone kn开发者_如何学运维ow what exactly this EF wants? Thank you!


Right-click the Model in the Solution Explorer. Select "Open with..." Select "XML (Text) Editor" in the dialog. Remove all nodes and references of the LinkingTable (or whatever its real name is) from the model's xml. Close all model files that are currently opened (I know, weird). Build the project. Open the model again. Everything should be fine now.


Open Model Browser, In the Entity types, select the table which is to be deleted, It will remove all the associations with the table.

It worked well for me.

0

精彩评论

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

关注公众号