Mapping Stored Procedures
LINQ to SQL allows mapping stored procedures from the SQL Server database into a .NET method that you can use within your object model and that is managed by the running instance of the DataContext. In this way you do not lose advantage of stored procedures when working with LINQ. To map a stored procedure, go back to the Visual Studio Designer for LINQ to SQL and ensure that the Methods pane is opened on the right side of the designer; then open Server Explorer, expand the database structure, and expand the Stored Procedures folder. After you’ve done this, drag the stored procedure you need onto the Methods pane. Figure 25.8 shows how to accomplish this against the Northwind database of the current example.
Figure 25.8 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access