© Eric Vogel 2021
E. VogelBeginning Entity Framework Core 5https://doi.org/10.1007/978-1-4842-6882-7_13

13. Stored Procedures

Eric Vogel1  
(1)
Okemos, MI, USA
 

In this chapter, I will cover how to call stored procedures using Entity Framework Core 5. I will show how to call both a stored procedure that returns results and one that inserts a record. I will also show how you can pass parameters to stored procedures. Some examples of where it makes sense to use a stored procedure instead of directly using Entity Framework Core are when you have to do complex queries for reporting or when performing bulk data operations.

Add Stored Procedures to a Database

We first need to add our stored procedures to the database. To make this simple, I will be creating ...

Get Beginning Entity Framework Core 5: From Novice to Professional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.