Hello,
I want to generate a pdf file on the backend using the reporting engine.
The report gets loaded with an instance of my implementation of the IReportSourceResolver.
The report uses a SharedDataSource. And I have also an implemenation of the ISharedDataSourceResolver.
I use the reporting engine in the following way:
ReportSource reportSource = _resolver.Resolve(reportName, OperationOrigin.GenerateReportDocument, resolvedParams);
var processor = new ReportProcessor();
var deviceInfo = new System.Collections.Hashtable();
RenderingResult result = processor.RenderReport("PDF", reportSource, deviceInfo);
After saving the result to File I get the pdf, but is shows a big red error box with the following message:
An error has occurred while processing Table 'table1': Cannot instantiate the referenced DataSource. Could not find file 'C:PATH TO A SHARED DATA SOURCE FILE'
This error lets my think that the reporting engine is not using its configured instance of the ISharedDataSourceResolver and is using the default filebased resolver(?).
I have it configured with the following value in the appsettings.json file:
"telerikReporting": {
"processing": {
"sharedDataSourceResolver": {
"provider": "custom",
"parameters": [
{
"name": "typeName",
"value": "NameSpaceAndClassName, containing AssemblyName"
}
]
}
}
}
In program.cs I have the following:
For the reporting engine and viewer, as far as I understand:
builder.Services.AddScoped<IReportServiceConfiguration>(sp =>
{
return new ReportServiceConfiguration
{
// ReportingEngineConfiguration = sp.GetService<IConfiguration>(), //(?? is this needed? does not load config either
Storage = new FileStorage(),
ReportSourceResolver = sp.GetRequiredService<DatabaseReportSourceResolver>()
};
});
And for the designer, as far as I understand:
builder.Services.AddScoped<ISharedDataSourceStorage, DatabaseSharedDataSourceStorage>();
builder.Services.AddScoped<IReportDesignerServiceConfiguration>(sp => new ReportDesignerServiceConfiguration
{
DefinitionStorage = new DatabaseDefinitionStorage(sp.GetRequiredService<IReportDefinitionDataStore>()),
SharedDataSourceStorage = sp.GetRequiredService<ISharedDataSourceStorage>(),
SettingsStorage = new FileSettingsStorage(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Telerik Reporting")),
});The webDesigner is working, and does load the shared datasources. The problem is with the Reporting engine.
Hope for some clarifaction
Kind regards
I think this post can be closed/removed. And hope I get an anwser in my other post.