What can be used to return multiple result sets?

What can be used to return multiple result sets?

Multiple result sets can be returned from an SQL procedure by using multiple cursors. To return multiple cursors the following must be done: Specify the DYNAMIC RESULT SETS clause in the CREATE PROCEDURE statement. Specify the maximum possible number of result sets likely to be returned.

How do I return multiple results in Entity Framework?

In order to get multiple result sets working we need to drop to the ObjectContext API by using the IObjectContextAdapter interface. Once we have an ObjectContext then we can use the Translate method to translate the results of our stored procedure into entities that can be tracked and used in EF as normal.

How do I update a stored procedure in Entity Framework?

To refresh an existing stored procedure in edmx file,

  1. Go to “Model Browser” > “Function Imports” > find the desired stored procedure class > right click and click on “Edit”
  2. In “Edit Function Import” form, in “Returns a Collection Of” section, click on “Update” button.
  3. Click “OK” to finish the refresh.

How to get multiple result sets to work?

In order to get multiple result sets working we need to drop to the ObjectContext API by using the IObjectContextAdapter interface. Once we have an ObjectContext then we can use the Translate method to translate the results of our stored procedure into entities that can be tracked and used in EF as normal.

When do you need to return more than one result set?

Sometimes when using stored procedures you will need to return more than one result set. This scenario is commonly used to reduce the number of database round trips required to compose a single screen.

When to return more than one result set in a stored procedure?

Sometimes when using stored procedures you will need to return more than one result set. This scenario is commonly used to reduce the number of database round trips required to compose a single screen. Prior to EF5, Entity Framework would allow the stored procedure to be called but would only return the first result set to the calling code.

Can a Entity Framework support multiple result sets?

It is planned that the support for multiple result sets will be improved in future versions of Entity Framework and that performing the steps in this document will no longer be necessary.