Open connections with Stimulsoft designer(.NET Core app)

Stimulsoft Reports.NET discussion
Post Reply
arysmyatov
Posts: 6
Joined: Mon May 14, 2018 9:35 am

Open connections with Stimulsoft designer(.NET Core app)

Post 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.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post by Alex K. »

Hello,

We need some additional time to investigate the issue.

Thank you.
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

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

Thank you.
Post Reply