Page 1 of 2

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

Posted: Fri Jan 13, 2023 6:23 pm
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.

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

Posted: Fri Jan 13, 2023 10:55 pm
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.

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

Posted: Tue Jan 17, 2023 12:19 pm
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 6693 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.

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

Posted: Tue Jan 17, 2023 1:09 pm
by Lech Kulikowski
Hello,

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

Thank you.

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

Posted: Tue Jan 17, 2023 5:13 pm
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 6679 times
This is how I'm setting the property CacheMode:
stimulsoft_cache_mode_none.png
stimulsoft_cache_mode_none.png (35.01 KiB) Viewed 6679 times
I've attached the source code projects.
Am I doing something wrong?

Thank you!

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

Posted: Wed Jan 18, 2023 8:47 am
by Lech Kulikowski
Hello,

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

Thank you.

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

Posted: Wed Jan 18, 2023 12:24 pm
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 6646 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

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

Posted: Thu Jan 19, 2023 8:08 am
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.

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

Posted: Thu Jan 19, 2023 12:01 pm
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.

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

Posted: Thu Jan 19, 2023 7:04 pm
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.