Back to Devexpress

Bind a Report to an Entity Framework Stored Procedure

xtrareports-17307-feature-guide-to-devexpress-reports-bind-reports-to-data-entity-framework-bind-a-report-to-an-entity-framework-stored-procedure.md

latest3.6 KB
Original Source

Bind a Report to an Entity Framework Stored Procedure

  • Feb 18, 2026
  • 4 minutes to read

This tutorial binds a report to a stored procedure provided by an Entity Framework data model. Additionally, it maps report parameters to stored procedure parameters, producing a convenient interface for user-level data shaping.

Note

The approach described in this document requires your project to contain an EDMX file that defines a conceptual model. The Code-First approach to calling stored procedures is not supported by EFDataSource.

Bind to a Stored Procedure

To bind a report to a stored procedure, do the following.

  1. Click the report’s smart tag. In the invoked actions list, expand the drop-down menu for the DataSource property and click Add Report Data Source…

  2. In the invoked Data Source Wizard, select a new data connection. On the next page, select Entity Framework and click Next.

  3. Select the data context and click Next.

  4. On the next wizard page, specify the data connection type and connection string to be used to establish a data connection and click Next.

  5. The next wizard page allows you to add stored procedures to the data source and configure their parameters. To add a stored procedure, click Add.

  6. Next, specify values for the stored procedure parameters in the list of stored procedure parameters. A stored procedure parameter value can be either static or generated by an expression. In this document section, static parameter values are used.

Pass Parameters to the Stored Procedure

To map report parameters to parameters of a stored procedure, do the following.

  1. To edit stored procedure parameters, select the Entity Framework data source in the Report Explorer and click the ellipsis for its EFDataSource.StoredProcedures property in the Properties window.

  2. The Manage Stored Procedures dialog will be invoked. Select the required stored procedure from the list of stored procedures to edit its parameters. For each stored procedure parameter that you want to map to a report parameter, activate the Expression check box, which allows you to use expressions to calculate parameter values. Next, expand the drop-down list for the Value property and select New Report Parameter to create a new report parameter, and use a reference to this parameter as a simple expression to generate a value that will be passed to the stored procedure.

View the Result

A parameterized report bound to a stored procedure is now ready. To view the result, drop data fields that you want to display in your report onto appropriate report bands and switch to the Preview Tab of the Visual Studio Report Designer. Enter values for required report parameters in the Parameters panel, and click Submit.

See Also

Bind a Report to an Entity Framework Data Source