Page 1 of 1

Open connections with Stimulsoft designer(.NET Core app)

Posted: Fri Nov 16, 2018 11:14 am
by arysmyatov
Hi,

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);
}
The user can see the document(report template) at the stimulsoft designer but could not retrieve any data from the data base by the connection and can not preview the document. The user has an error message every time : “Cannot access a disposed object. Object name: ‘Npsql.Connection’”

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.

Re: Open connections with Stimulsoft designer(.NET Core app)

Posted: Tue Nov 20, 2018 6:56 pm
by Alex K.
Hello,

We need some additional time to investigate the issue.

Thank you.

Re: Open connections with Stimulsoft designer(.NET Core app)

Posted: Wed Nov 28, 2018 7:51 am
by Lech Kulikowski
Hello,

Please send us a simple project which reproduces the issue. We need to see your UpdateConnections method.

Thank you.