在实体框架 3.5 中刷新存储过程 [英] Refreshing a stored procedure in entity framework 3.5

查看:31
本文介绍了在实体框架 3.5 中刷新存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 .NET 3.5 SP1、VS 2008 和实体框架.我最初向我的模型添加了一个存储过程,它带有 2 个参数.后来,我将 sproc 更改为仅带 1 个参数.我运行了 Update Model From Database 菜单选项并确认我的 sproc 列在 Refresh 选项卡中.完成向导,清理并重建解决方案,模型从未更改 sproc 的签名.

I am using .NET 3.5 SP1, VS 2008 with the entity framework. I originally added a stored procedure to my model which took 2 parameters. Later, I changed the sproc to just take 1 parameter. I ran the Update Model From Database menu option and confirmed that my sproc was listed in the Refresh tab. Finished up the wizard, cleaned and rebuilt the solution and the model never changed the signature of the sproc.

怎么不更新了?数据库功能的更新模型是否已损坏?我错过了什么吗?谢谢.

Why isnt it updating? Is the Update model from database feature broken? Am I missing something? Thanks.

推荐答案

在将存储过程添加到实体框架后更新存储过程时,我看到了两个问题:

I've seen two problems with updating a Stored Procedure after adding it to the entity framework:

  • 为调用 SPROC 而创建的函数导入未更新(不正确、过时的参数)
  • 为 SPROC 结果集创建的复杂类型未更新(不正确、过时的字段)

更新 EDMX 模型(函数导入)

  1. 打开 .edmx 文件(在 GUI 设计器中).
  2. 右键单击某个空白区域,然后选择从数据库更新模型".
  3. 在弹出窗口中单击完成(如果可以).应该更新您的 SPROC 的签名(以及任何函数导入).

更新存储过程复杂类型

  1. 打开模型浏览器"窗口,同时打开 .edmx.

  1. open the "Model Browser" window while you have the .edmx open.

展开 ContentModelEntityContainer: ...Function Imports 节点.为您的存储过程查找函数导入并双击它.将打开您用来创建它的同一个窗口,但现在填充了其数据.

Expand the ContentModel, EntityContainer: ..., and then Function Imports nodes. Look for the function import for your stored procedure and double click it. The same window you used to create it will open, but now populated with its data.

点击获取列信息按钮(查看按钮下方的网格以了解将要更改的内容).

Click the Get Column Information button (look at the grid below the button to see what will be changed).

点击复杂"单选按钮选项旁边的更新按钮.

Click the Update button next to the "Complex" radio button choice.

点击确定,结果集的复杂类型应该会更新.

Click OK, and the Complex Type for your result set should be updated.

这篇关于在实体框架 3.5 中刷新存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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