Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Stimulsoft Reports.WEB discussion
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

Hello!

I need to integrate the Stimulsoft.Reports.Web Designer with a .NET 6 C# Web API backend.
Frontend is an Angular 14 application.

The report was loaded with no problem, but when I try to save and use the method StiAngularDesigner.GetReportObject(this), the resulting report is null.
For testing purposes I've created a new backend using the .NET 6 C# MVC Application template, and the same frontend / backend code worked fine.

Can you help me?
Thank you.
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by Lech Kulikowski »

Hello,

Please check samples at the following link:
https://github.com/stimulsoft/Samples-Angular

if the issue is still present, please send us a sample project that reproduces the issue for analysis.

Thank you.
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

Hello!

My Web API is stateless and I think the Report Designer is trying to save each change in the server, before I really save the report file.
stimulsoft_cache_not_specified.png
stimulsoft_cache_not_specified.png (4.12 KiB) Viewed 3519 times
It only worked when I added the code " builder.Services.AddMemoryCache() " in the Startup.cs / Program.cs file.
But this application is running on multiple instances, so I cannot just use the server memory, because changes could be saved in different server instances.
I think we would need to configure an external cache, like Redis or something.

Is there an option in Designer to stop saving each change and save only when user clicks "Save" in the menu, sending the whole file?
If this option is not available, can you add in a new version?

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

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by Lech Kulikowski »

Hello,

You can set the CacheMode=None
https://www.stimulsoft.com/en/documenta ... ttings.htm

Thank you.
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

When I set CacheMode=None it starts showing the message "Your session has expired!"
stimulsoft_session_has_expired.png
stimulsoft_session_has_expired.png (3.46 KiB) Viewed 3505 times
This is how I'm setting the property CacheMode:
stimulsoft_cache_mode_none.png
stimulsoft_cache_mode_none.png (35.01 KiB) Viewed 3505 times
I've attached the source code projects.
Am I doing something wrong?

Thank you!
Attachments
StimulsoftDesignerWebApiTest.zip
(221.6 KiB) Downloaded 193 times
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by Lech Kulikowski »

Hello,

Please check the following topic:
viewtopic.php?t=59767

Thank you.
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

Hello!

I've changed the Post method in DesignController to load and return the report on every request.
stimulsoft_return_getreport.png
stimulsoft_return_getreport.png (27.49 KiB) Viewed 3472 times
I don't understand the need of doing server requests on every report change when cache is set to none, but the message "Your session has expired!" disappeared.

Now the problem is when saving the report template. User clicks "Save", the requestParams.Action is StiAction.SaveReport, but the report object is null.

Code: Select all

var report = StiAngularDesigner.GetReportObject(this); // null object
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by Vadim »

Hello.

Method StiAngularDesigner.GetReportObject(this); // null object
takes report from cache, so if you use CacheMode=None, - you must provide your own method to get report.
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

Hello!

So the designer is not compatible with stateless APIs?
The available options are setting up an external session/cache or provide myself a method to get the report?

Thank you.
diogo@forlogic.net
Posts: 10
Joined: Tue Jan 10, 2023 8:38 pm
Location: Brazil

Re: Stimulsoft.Reports.Web designer and .NET 6 C# Web API

Post by diogo@forlogic.net »

Hello!

As a workaround I've created a new stateful ASP.NET MVC Web App.
This new webapp will run all designer requests, like loading/saving reports and other commands.

Thank you.
Post Reply