LINQ to SQL using Stored Procedures

Updated on 31 Dec 2010,
Published on 22 Dec 2010

The O/R designer tool of Visual Studio Web Developer 2010 provides an in-built feature of mapping database tables and the stored procedures or functions that can be used for querying and manipulating the data items stored in the data store. In the previous tutorial: LINQ to SQL and O/R Designer, we learnt about the utility of object relation designer tool that enables to generate the automatic DataContext class which allows to map the database table by dragging and dropping them on the designer's workspace. Similarly, you can drag and drop the stored procedures from database explorer on to the O/R designer to auto-generate the strongly-typed methods that provide the functionality to retrieve the data and populate the entity classes. The return types of methods generated by dragging and dropping the stored procedures or functions on the designer surface may differ depending upon the place where you drop them.

There are two ways of dropping a stored procedure on the designer surface. When the function or stored procedure is dropped directly onto an existing entity class, it creates a DataContext method with its return type as of the entity class. Whereas, when they are dropped onto an empty area then the O/R tool creates a DataContext method having an auto-generated return type.

Following are the different types of Stored Procedures or functions, based on the types of input/output parameters and their return types, which can be used in an LINQ driven web application:

1. LINQ to SQL Stored Procedures to Return Multiple Data Rows using C#

2. LINQ to SQL Stored Procedures that Take Parameters using C#

3. LINQ to SQL Stored Procedures that Return Multiple Result Shapes using C#

4. LINQ to SQL Stored Procedures that Return Sequential Result Shapes using C#

5. LINQ to SQL Stored Procedures to Insert, Update and Delete using C#

Continue to next tutorial: LINQ to SQL Stored Procedures to Return Multiple Data Rows using C# to learn how to map a stored procedure that fetches multiple records from a database table.

0 Responses to "LINQ to SQL using Stored Procedures"
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email
  • HIRE EzineASP.Net Developers