Stored Procedures and updating EDMX

前端 未结 5 1560
你的背包
你的背包 2020-12-22 15:37

I have had endless issues with stored procedures and EDMX. I created a procedure, updated the model from the database, and all worked. I then removed a column and added a ne

相关标签:
5条回答
  • 2020-12-22 16:07

    The only fix I could find was to close the EDMX, and manually edit the XML, which, even after removing the stored proc from the database, and updating the model from the database - still had mention of the proc. Removing the lines from the XML has solved the issue.

    0 讨论(0)
  • 2020-12-22 16:15

    First of all do refresh your SP through "Update Model from Database", if it is working, fine, if not and throwing the same exception then do follow the steps given below. 1.Double Click on .edmx file. 2. In Model Browser, Delete SP from Complex Types, Function Imports and Stored Procedures/Functions. 3. Save All. 4.Add again your SP through "Update Model from Database". 5.Save All.

    0 讨论(0)
  • 2020-12-22 16:24

    (This solution is for EF 6. I have not tried in other EF versions. It works nice.)


    Go to Model browser. MyStoreProc is the name of the stored procedure (as an example). MyStoreProc will appear in 3 places.

    1. 1st place- Under Complex Types-> as MyStoreProc_result
    2. 2nd Place- Under Function Imports -> as MyStoreProc
    3. 3rd Place - Under Stored Procdures/ Functions -> as MyStoreProc

    Delete all three from model. Save the edmx (by clicking in the window then ctrl+S). Then right click and click update the model from database. Then add the updated stored procedure and Save again.

    Solved without any hassle :)

    0 讨论(0)
  • 2020-12-22 16:28

    To refresh an existing stored procedure in edmx file,

    1. Go to "Model Browser" > "Function Imports" > find the desired stored procedure class > right click and click on "Edit"
    2. In "Edit Function Import" form, in "Returns a Collection Of" section, click on "Update" button
    3. Click "OK" to finish the refresh.

    0 讨论(0)
  • 2020-12-22 16:29

    Follow these steps:

    Step 1: Open Edmx

    Step 2: Open Model Browser

    Step 3: Open Complex Types and remove your procedure_Result

    Step 4: Open Functions Imports and delete your procedure

    Step 5 Open StoredProcedur and Functions and delete your procedure

    Step 6: Save Edmx (Ctrl+S), Clean Solution , Update Model From Database and select your procedure which you would like to get updated then finally clean, build solution. Done !

    0 讨论(0)
提交回复
热议问题