суббота, 6 ноября 2010 г.

Binding Stored Procedure Result from Entity Framework to ObjectDataSource Control

Binding Stored Procedure Result from Entity Framework to ObjectDataSource Control: "Not too long ago someone asked me how can they bind data returned from stored procedure to a gridview control. There are several ways to achieve that. You can either use EntityDataSource or ObjectDataSource Control. I find it easier to use ObjectDataSource control because it allows me to encapsulate logic inside my classes. The basic steps are as follows

1. Bring the Stored Procedure into the storage model.

2. Import the stored procedure into conceptual model. This will result in a method getting exposed on your derived object context.

3. Create a class that you can bind to ObjectDataSource control. On the class expose a method that returns data returned from the method created on your derived Object Context."

Комментариев нет: