Search code examples
c#sql-serverentity-frameworkef-database-first

Added stored procedure in database, how to get in EF Context?


I did a database-first approach with Entity Framework, so I basically created a data model object, set the connection string, and the .edmx, context, and all related files were created in an instance. When I put right click the edmx file in designer mode, and click update model from database, it doesn't update the context. I have a new stored procedure in the database I want to show in the context, how can I get it in there?


Solution

  • When you do the update model from database, it should let you choose which database objects (stored procedures, functions, tables, etc.) you want to add/remove/refresh.

    1. right click in the edmx designer, click update model from database
    2. click next
    3. you should see a screen that says "choose your database objects and settings" there should be a "stored procedures and functions" category for you to add the new SP from