We use stimulsoft at our .net core web application. In this application we use the stimulsoft as a designer to provide the user with a possibility to make a report template.
It’s used the code like this at the application to get the report template at the designer UI:
Code: Select all
public IActionResult GetReport()
{
var report = new StiReport();
report.Load(StiNetCoreHelper.MapPath(this, "Reports/SimpleReportTemplate.mrt"));
var connection = new NpgsqlConnection { ConnectionString = connectionString }; // some connection string to PostgreSQL server:
// report.RegData(ConnectionName, connection);
try
{
connection.Open();
UpdateConnections(connection, report); // here it is updating (substitute) the connection string at the report
report.Dictionary.Synchronize();
report.Render();
var reportResult = StimulsoftReportResult.Create(report.SaveDocumentToByteArray());
reportResult.ReportGeneratorType = new ReportGenerationType(TemplateType.Stimulsoft, templateName);
return reportResult;
}
finally
{
connection.Close();
}
return StiNetCoreDesigner.GetReportResult(this, report);
}
https://www.dropbox.com/s/9oatb9z6nsp0u ... 1.jpg?dl=0
Everything is fine If we do not close the connection at the code but the connection to DB will be still open even the user close the browser tab.
So, if the user open the application with Stimulsoft designer e.g. 10 times – there will be 10 open connections to the DB.
Could you please suggest any solution how to manage this situation in case it’s used RegData method to substitute the connection string at the report.