Chapter 16. Gaining Additional Stored Procedure and View Support in the Raw XML

In Chapter 7, you learned about function mapping and function imports to map stored procedures in the Entity Data Model (EDM). Mapping read, insert, update, and delete stored procedures to entities is the simplest way to use stored procedures in the EDM. Thanks to new Designer features that you worked with in that chapter, it is also now fairly easy to work with stored procedures that return results that don’t map to an entity—by returning complex types instead. There are still a number of scenarios involving stored procedures that haven’t been addressed yet—those that require working directly in the XML of the EDMX file.

This chapter will cover ways to implement stored procedures beyond the function mapping you already performed in the Designer. These additional implementations will create functions that you can call directly in your code.

In addition to implementing stored procedures from your database, you’ll also learn how to create native functions and views directly in your model.

The first part of the chapter will focus on stored procedures that are used for querying the database. The latter part of the chapter will address stored procedures for performing inserts, updates, and deletes in your database. You’ll also learn a few more tricks with respect to database views and user-defined functions along the way.

Reviewing Procedures, Views, and UDFs in the EDM

As you have learned in earlier parts of ...

Get Programming Entity Framework, 2nd Edition 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.