IReportDesignerModelBuilder.DataSources(IDictionary<String, Object>) Method
In This Article
Registers data sources so that they are available in Web Report Designer when you edit reports.
Namespace: DevExpress.XtraReports.Web.ReportDesigner.Services
Assembly: DevExpress.XtraReports.v24.2.Web.dll
NuGet Package: DevExpress.Web.Reporting.Common
#Declaration
IReportDesignerModelBuilder DataSources(
IDictionary<string, object> dataSources
)
#Parameters
Name | Type | Description |
---|---|---|
data |
IDictionary<String, Object> | A data source dictionary where the key is the name of the data source and the value is an instance of the data source. |
#Returns
Type | Description |
---|---|
IReport |
A IReport |
#Remarks
The following code example is the controller Action that registers data sources for use in the Web Report Designer:
public class CustomReportDesignerController : ReportDesignerController {
public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) {
}
[HttpPost("[action]")]
public IActionResult GetDesignerModel(
[FromForm]string reportUrl,
[FromServices] IReportDesignerModelBuilder designerModelBuilder,
[FromForm] ReportDesignerSettingsBase designerModelSettings) {
var 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();
var designerModel = designerModelBuilder.Report(reportUrl)
.DataSources(dataSources => {
dataSources.Add("Northwind", ds);
})
.BuildModel();
designerModel.Assign(designerModelSettings);
return DesignerModel(designerModel);
}
}
For more information, review the following help topic: Data Sources in Web End-User Report Designer (ASP.NET Core).
See Also