Prevent report calling all object properties getter

Stimulsoft Reports.NET discussion
Post Reply
jakijim
Posts: 6
Joined: Fri Sep 19, 2014 6:06 am

Prevent report calling all object properties getter

Post by jakijim »

Hello,
By default, when using list of objects in report datasource, report generator call all of object properties and even nested ones.
Sometimes calling an object property must done under some conditions. For example when calling property caused to generate and execute a database query, so this caused error when there is no suitable and open session to database.
In such scenario, it is necessary to prevent calling of such properties.
Is there any way to prevent report generator calling unnecessary properties?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Prevent report calling all object properties getter

Post by Alex K. »

Hello,

Please try to use the RegBusinessObject() method for registration data for the report.

Thank you.
jakijim
Posts: 6
Joined: Fri Sep 19, 2014 6:06 am

Re: Prevent report calling all object properties getter

Post by jakijim »

Hi Aleksey,
Thank you for reply.
Calling RegBusinessObject instead of RegData just result that only first level of object properties is accessible. What I need is getting only those properties needed in report. That may even include nested properties.

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Prevent report calling all object properties getter

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

report.RegBusinessObject();
report.Dictionary.SynchronizeBusinessObjects(necessaryLevel);
Thank you.
jakijim
Posts: 6
Joined: Fri Sep 19, 2014 6:06 am

Re: Prevent report calling all object properties getter

Post by jakijim »

Hi Aleksey,
Sorry if I didn't explain enough the issue.
In fact, I want report generator does not create a list of object properties. Instead, property getter must calls as requested. So there is no need to create a list consist tons of non-required and problematic properties.Suppose we pass a list of "object" (not a specific type) to report. So at run time, the report engine calls only the required properties that may be in any level.
In other words, In any level of object properties there may be both "required" and "non-required and problematic" properties.

Thanks a lot
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Prevent report calling all object properties getter

Post by Alex K. »

Hello,

In this case you can check which object are used in the report:
StiBusinessObjectHelper.GetUsedBusinessObjectsNames(report);
StiDataSourceHelper.GetUsedDataSourcesNames(report);
and register only necessary.

Thanky ou.
Post Reply