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

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

问题描述

我正在使用.NET 3.5 SP1,VS 2008与实体框架。我最初添加了一个存储过程到我的模型,它有2个参数。后来,我改变了sproc只需要一个参数。我运行从数据库更新模型菜单选项,并确认我的sproc已列在刷新选项卡中。完成了向导,清理和重建了解决方案,模型从未改变过sproc的签名。



为什么不更新?来自数据库功能的更新模型是否已断开?我错过了什么吗?谢谢。

解决方案

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




  • 创建用于调用SPROC的功能导入未更新(不正确,过时的参数)

  • 为SPROC的结果集创建的复杂类型未更新(不正确,过期字段)



更新EDMX模型(功能导入)


  1. 打开.edmx文件(在GUI设计器中)

  2. 在一些开放空间中右键单击并选择从数据库更新模型。

  3. 在弹出窗口中单击完成(如果能)。应该更新您的SPROC的签名(以及任何功能导入)。

更新存储过程复杂类型 / p>


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


  2. 展开 ContentModel EntityContainer:... ,然后展开功能导入节点。查找您的存储过程的功能导入,然后双击。您用于创建它的窗口将打开,但现在已填充其数据。


  3. 单击获取列信息按钮


  4. 点击复合旁边的更新按钮,单选按钮选择。


  5. 点击确定,结果集的复合类型应该更新。



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:

  • The Function Import created to call the SPROC wasn't updated (incorrect, out-of-date parameters)
  • The Complex Type created for the SPROC's result set wasn't updated (incorrect, out-of-date fields)

Updating EDMX model (function import)

  1. Open the .edmx file (in the GUI designer).
  2. Right-click in some open space and select "Update Model from Database".
  3. Click Finish (when able) on the pop-up window. Your SPROC's signature should be updated (along with any Function Imports).

Updating stored procedure complex type

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

  2. 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.

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

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

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

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

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