IReportDesignerModelBuilder.DataSources(Action<IDictionary<String, Object>>) Method
Allows you to modify a collection of data sources available in the Web Report Designer.
Namespace: DevExpress.XtraReports.Web.ReportDesigner.Services
Assembly: DevExpress.XtraReports.v24.2.Web.dll
NuGet Package: DevExpress.Web.Reporting.Common
Declaration
Parameters
Name | Type | Description |
---|---|---|
configure | Action<IDictionary<String, Object>> | A delegate that performs an action on a data source dictionary. |
Returns
Type | Description |
---|---|
IReportDesignerModelBuilder | A IReportDesignerModelBuilder that can be used to further configure the Report Designer. |
Remarks
The following code example is a controller action that creates a new data source and adds it to the data sources available in the Report Designer:
public IActionResult ReportDesigner(
[FromServices] IReportDesignerModelBuilder reportDesignerModelBuilder,
[FromQuery] string reportName) {
// Create a SQL data source with the specified connection string.
SqlDataSource ds = new SqlDataSource("NWindConnectionString");
// Create a SQL query to access the Products data table.
SelectQuery query = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products");
ds.Queries.Add(query);
ds.RebuildResultSchema();
reportName = string.IsNullOrEmpty(reportName) ? "TestReport" : reportName;
var designerModel = reportDesignerModelBuilder
.Report(reportName)
.DataSources(x => {
x.Add("Northwind", ds);
})
.BuildModel();
return View(designerModel);
}
For more information, review the following help topic: Data Sources in Web End-User Report Designer (ASP.NET Core).
See Also