2

I tried to add two stored procedures (that just return data from a view) to EDMX file. But after completing the wizard, the stored procedures do not show up in the designer. I'm totally stuck and unable to understand why the stored procedures are not added to the designer. Is there any limitations to add stored procedure to EDMX?

I'm using Visual Studio 2013, Entity Framework 6.1 and SQL Server 2012

xk0der
  • 3,660
  • 4
  • 26
  • 35
ps_prakash02
  • 543
  • 4
  • 18
  • 1
    Stored procedures are not shown on the designer as you put only your model there. Stored procedures are functions, you should be able to find them somewhere... and you can map the result of the stored procedure to an object of your model, or let hem create a custom one. – Laurent Lequenne Apr 11 '15 at 18:50
  • Do you have any new files in your project after adding the stored procedures. Using source control will make this super easy to spot, BTW. – DWright Apr 11 '15 at 19:22
  • 1
    Thanks.. but even in model browser also the stored procedures are not shown up.. can you tell me where I need to look in ? – ps_prakash02 Apr 12 '15 at 01:04

3 Answers3

5

Did you try the process with the option "Import selected stored procedure and..." unchecked?

This option is not listed in EF4, and it is active by default in EF6. I had the same issue, but after making sure this option was not checked while adding a Stored Procedure, the problem was solved.

Hope it helps.

xk0der
  • 3,660
  • 4
  • 26
  • 35
0

Use the model browser. The stored procedures will not show up as entities. Open on the edmx file. Right click on the model and select Model Browser. Another view will pen with a list of diagrams, tables/views stored procedures/functions etc.

enter image description here

0

If Stored Procedure does not appear in EDMX file even after Updating Model from Database, try the steps:

  1. Double click EDMX file in Solution Explorer and click Model Browser* > Function Imports > Right click on SP and Edit.
  2. Under Stored Procedure/ Function Column Information section, click Get Column Information.
  3. Click Create Complex Type and OK on window.

Save the EDMX file and the SP must appear in the Solution Explorer.

*If Model Browser is not visible, go to View > Other Windows > Entity Data Model Browser (VS 2019)

Jaggan_j
  • 488
  • 1
  • 8
  • 9