Retrieve table data from stored procedure using entity framework

c# entity-framework entity-framework-6 sql-server stored-procedures

Accepted Answer

  1. The saved process must be imported as a function. Right-click your Entity model's workspace area and selectAdd -> Function Import .
  2. Enter the name your stored procedure should be known by in your model in the Add Function Import dialog, for instance.GetCountryListSP select your process from the drop-down box, then select what the procedure's return value should be.Entities and decideCountryName via the drop-down menu.
  3. next, in the code:

    var result = db.GetCountryListSP();//Send parameters too
    

    With this strategy, you avoid going back.-1 of the stored procedure. For additional information regarding the stored procedure issue with Entity Framework, please see the this post.

11
5/23/2017 12:25:51 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow