将表重新添加到实体模型(edmx)时不显示表 [英] Tables don't show when re-adding them to entity-model (edmx)

查看:269
本文介绍了将表重新添加到实体模型(edmx)时不显示表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有5个表的数据库。一开始,我已经添加了这些表,但是由于某些关系编译错误,我决定删除一些表。



现在,当我想将它们重新添加时,我正在打开edmx文件->从数据库更新模型...我在添加选项卡下看不到那些表,只在刷新选项卡下看到了。



如何重新添加它们?

解决方案

要将表重新添加到模型中,您首先需要删除模型中的表格。 (表的列表在[model.Store]树中可见(请参见 模型浏览器窗格,您可以从鼠标右键单击菜单中打开它。)
运行



要完成的步骤:



要从数据库更新模型...,该表将出现在更新向导第一步的添加标签中。 p>


  1. 在Visual
    Studio中关闭模型。

  2. 在$中打开.edmx文件b $ b文本编辑器。

  3. 搜索并删除
    xml实体元素(请参见下面的注释
    )。

  4. 打开


  5. 数据库中单击更新模型。

要删除对模型中表的所有引用:




  • 在 EntityContainer元素中,
    删除所有


  • 'EntityContainer'元素中,将'Name'属性设置为
    的'EntitySet'子元素
    设置为[TableNameToReAdd]值。删除所有
    'AssociationSet'子元素在存在结束元素的
    的ts中,其 EntitySet属性设置为
    的值是[TableNameToReAdd]。


  • 'EntityContainer'元素中,删除所有
    'EntityType'子元素,其中
    的名称属性设置为
    值[TableNameToReAdd]。


  • 'EntityContainer'元素中,删除存在
    'End'元素且具有$ b $的所有
    'Association'子元素b角色属性设置为值
    [TableNameToReAdd]。


I have a db with 5 tables. At the beginning, I've added those tables in, but then decided to remove some due to some relationship compile error.

Now, when i want to add them back, i'm opening the edmx file -> update model from database... I don't see those tables under add tab, but only under the "refresh" tab.

How can i add them back?

解决方案

In order to re-add a table to your model you will first need to delete the table from your model. (a list of tables is visible in the [model.Store] tree (see 'Model Browser' pane- you can open it from right-mouse click menu). When you run 'Update model from database...' the table will appear in the 'Add' tab in the first step of the 'Update Wizard'.

Steps to complete:

  1. Close your model in Visual Studio.
  2. Open your .edmx file in a text editor.
  3. Search and delete the xml entity elements (see notes below).
  4. Open your model in Visual Studio.
  5. Click Update Model from Database.

To delete all references to a table in your Model:

  • In the 'EntityContainer' element, delete all 'EntitySet' child elements that have the 'Name' attribute set to the value [TableNameToReAdd].
  • In the 'EntityContainer' element, delete all 'AssociationSet' child elements where an 'End' element exists that have their 'EntitySet' attribute set to the value [TableNameToReAdd].
  • In the 'EntityContainer' element, delete all 'EntityType' child elements where that have the 'Name' attribute set to the value [TableNameToReAdd].
  • In the 'EntityContainer' element, delete all 'Association' child elements where an 'End' element exists that have their 'Role' attribute set to the value [TableNameToReAdd].

这篇关于将表重新添加到实体模型(edmx)时不显示表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆