Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
779 views
in Technique[技术] by (71.8m points)

visual studio 2008 - Refreshing a stored procedure in entity framework 3.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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...