0

i have added stored procedures along with some table through entity framework i can able to see tables under xyzContext.tt but no SP's are visible there and how can check my SP is loaded into a project

SumitS.
  • 65
  • 2
  • 12
  • 3
    Possible duplicate of [How to call Stored Procedure in Entity Framework 6 (Code-First)?](https://stackoverflow.com/questions/20901419/how-to-call-stored-procedure-in-entity-framework-6-code-first) – Andrei Dragotoniu Feb 26 '19 at 10:05

2 Answers2

0

If you are using code first, then you can add SP to DbContext using method MapToStoredProcedures

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<T>()
                    .MapToStoredProcedures();
    }
Muaddib
  • 495
  • 5
  • 12
0

If you navigate to the edmx model in the solution explorer and then double click on it to open it. Once the model is open, right click to bring up the context menu and select the 'Model Browser' option.

Context Menu

Once the model browser is open you should be able to find the stored procedures contained in the model under the stored procedures folder:

EMDX Model Browser

If the stored procedures that you added do not appear here then check the visual studio 'Error List' window as there may be something wrong with them and the errors should be reported here.

enter image description here

Tom Maher
  • 1,914
  • 2
  • 23
  • 39