ASP.NET Core
Register the engine and return a report from a controller.
Add ReportDesigner.AspNetCore to your app. See the download page for the GitHub Packages feed. In Program.cs, point the engine at your report project and map the report’s connection name to your app configuration.
builder.Services.AddReportDesigner(options =>
{
options.ProjectPath = @"D:\CompanyReports";
options.Connections["Sales"] = builder.Configuration.GetConnectionString("Sales")!;
});
Set ReportsPath instead if you have a folder of report files outside a project. See Connect to data for MySQL connection strings.
Render a report
Inject IReportService into the controller. Pass the report name and parameters to RenderAsync to run the report’s own stored procedure.
public sealed class InvoicesController(IReportService reports) : ControllerBase
{
[HttpGet("reports/sales")]
public async Task<IActionResult> Sales(DateTime from, DateTime to, CancellationToken ct)
{
var pdf = await reports.RenderAsync("sales-summary", new { FromDate = from, ToDate = to }, ReportFormat.Pdf, ct);
return File(pdf, "application/pdf");
}
}
If you already have the rows, pass them before the parameters. Use ReportData to pass several data sets together. To render over HTTP, switch to the report server in configuration and keep the same service call.