简体   繁体   中英

Why my complex types is not updated when i add a stored procedure into edmx in Visual Studio 2017?

I'm using the Entity Framework to create a complex types from some stored procedures. Now, I changed one of the stored procedure to display 2 more fields.

I'm trying to update the complex type that maps to this stored procedure, but it's not working, Also: I tried both approaches:

  1. Delete all 3 parts in model, and add again
  2. Update the Model from the database and then update function imports

but they did not work!

Also, in the first way, when I add the stored procedure to the model, the complex type isn't updated. Besides, in the second way, when I "Edit Function Imports" and "Get Column Information", I get a message

The selected stored procedure or function returns no columns

while it's returning about 30 columns through a select statement!

The last part of my stored procedure is like this:

select * 
from MyTable  
where Name like '%My Name%'

This problem happened with me when I update the EDMX from existing database, but I solve it through:

  1. Check the output of stored procedure in your database.
  2. Do this steps:
    • Delete the EDMX.
    • Delete the connection string in app.config, save app.config and close app.config.
    • Clean the project.
    • Add EDMX again.
    • Rebuild the project.

hope this fix the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM