Business Object does not show properties (fields)
Hi there!
I'm evaluating FastReport .NET Trial 1.1. Congratulations on this AWESOME product!! I've been using FastReport for Delphi for quite some time and after switching to .NET I really missed the best reporting engine on the market !!! I'm so glad I have my "good old" FastReport back in the .NET world :-)
Before I purchase I need to solve one big problem I'm currently having:
My application relies heavily on business objects, so I need to add those as datasources. But when I add my BO and open up FR designer, I only see the datasource (table) in the tree, but no fields (as if FastReport didn't see any properties of my BO). On a sidenote: All propeties are marked public, so that can't be the problem.
In the FR code window I can access the properties of my BO, but the code completion doesn't work on them.
Do you have any idea what could be the cause of this problem?
Thanks in advance!
Marco
I'm evaluating FastReport .NET Trial 1.1. Congratulations on this AWESOME product!! I've been using FastReport for Delphi for quite some time and after switching to .NET I really missed the best reporting engine on the market !!! I'm so glad I have my "good old" FastReport back in the .NET world :-)
Before I purchase I need to solve one big problem I'm currently having:
My application relies heavily on business objects, so I need to add those as datasources. But when I add my BO and open up FR designer, I only see the datasource (table) in the tree, but no fields (as if FastReport didn't see any properties of my BO). On a sidenote: All propeties are marked public, so that can't be the problem.
In the FR code window I can access the properties of my BO, but the code completion doesn't work on them.
Do you have any idea what could be the cause of this problem?
Thanks in advance!
Marco
Comments
Please check this post:
http://www.fast-report.com/en/forum/?p=/discussion/5695
BO fields are not supported, you should use properties instead.
Hi Alex. I know... but I do have properties! No fields.... (sorry for the confusion: In my first post I only used the term "field" to make an analogy to the DB world).
I have properties exactly like described in your article. In the meantime I tried creating a new BO object of my type in FR script. From there I get code completion to see my properties. But the data tree will not display them...
Any more ideas?
Thanks!
Marco
PS: I should note that I derive my classes from a persistence framework. Maybe you know it: DevExpress.Xpo. I have added all necessary base assemblies to the FReport.ReferencedAssemblies property.
I'm not familiar with DevExpress Xpo. Here is how you can check your business objects:
The latest version of FR.Net (1.1.20 and later) uses the same method when discovering the object's structure.
Hi Alex.
Thanks for the code snippet. I ran it on my BO and it returned all the properties correctly... very strange.... they just won't show up in the designer.
I'll play around some more. Let me know if you can think of any other thing to try.
Regards
Marco
src.DataSource = your_business_object.GetType();
It works in most cases, but in your case it may fail. I will fix this in the next daily build (it will be ready in three hours).
Hi Alex! You're right, I get no properties when I use the code line from your last post.
Thank you so much for making a new build. Looking forward to it.
Regards
Marco
I downloaded and installed the new build. Now FR sees the property! Thank you!!!!
I just have one last problem: While FR sees 1:n (subcollections) perfectly, it does not seem to recognize 1:1 references. In the attached screenshot you'll see that my "Party" object has a subcollection of Addresses, which is correct. But the sub-object "Language" does not display any real properties. But in reality it contains properties like "Name" etc.
So right now I can't have a report displaying [Contact.Language.Name]; FR fails with the message: "The name 'Contact' does not exist in the current context"
Do I need to add some attribute to resolve the properties of single sub-objects? Or do you know what else could be the problem?
Thanks again!
Marco
Could you show me the structure of your classes? I'm interested in "Language" and "Addresses" classes.
- My system is designed to be customizable for end customers. That's why I usually have an abstrace base class and an empty concrete class derived from it (CustParty --> Party, etc.)
- The base class "BaseObject" is part of the XAF framework (persistence) by DevExpress.
- XPCollection is an IEnumerable by the XAF framework which queries the DB and delivers all necessary objects from the DB store.
- All those calls to "SetPropertyValue" (and similar) basically just tell the XAF framework to do something (e.g. notify the UI of changes etc.)
If you have any other questions just ask!
Regards
Marco
Would it help you if I created an isolated sample application to re-create the problem? You'd probably have to install a trial version of the corresponding DevExpress components. I could direct you to the download link for that also.
Let me know.
Regards
Marco
I created a very small sample application which reproduces the problem. I think you don't even have to download the DevExpress stuff since the DLL's are included. If it doesn't work you need to download and install DXperience-9.1.4.exe from:
http://www.devexpress.com/Downloads/NET/
Kind regards!
Marco
I will inspect the test project and let you know when I fix the problem.
Hi Alex! Thanks so much!! I see that you posted a new version on your main website (dated June 19). I downloaded and installed it, but the changes you mentioned above don't exist. Maybe I just tried too early!?
Have a great weekend! And thanks for your excellent support! I'll let you know my results as soon as I get to test the latest updates.
Marco
So this weekend I can get started on my XAF module for FastReport integration! Awesome!
Thanky you so much again!
Regards
Marco
PS: If I purchase the WinForms/WebForms version of FR.NET, will I be able to upgrade to Professional for the price difference later on?
Sure. You can start with WinForms and upgrade if necessary.