Using Business Objects in the Report
Our sample projects and report templates can help you learn the basics of working with our products.Register application objects as a data source in .NET 8.0 and make their fields available to the report template.
Registering objects. In the report action, pass your collection to
Registering objects. In the report action, pass your collection to
RegData under a name that matches the template:public IActionResult GetReportITypedList()
{
var report = new StiReport();
report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_ITypedList.mrt"));
report.RegData("EmployeeITypedList", CreateBusinessObjectsITypedList.GetEmployees());
return StiNetCoreViewer.GetReportResult(this, report);
}
public IActionResult GetReportIEnumerable()
{
var report = new StiReport();
report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_IEnumerable.mrt"));
report.RegData("EmployeeIEnumerable", CreateBusinessObjectsIEnumerable.GetEmployees());
return StiNetCoreViewer.GetReportResult(this, report);
}Binding to business objects lets a report consume the very same domain classes your application already uses, whether they expose data through IEnumerable or the richer ITypedList interface, without converting them to datasets first.