Problem with 1:1 subobject in business objects datasource
Hi Alex
I've already made a huge step forward in integrating FastReport with XAF. The module is in beta stage. I'm waiting for DevExpress to fix a few bugs in their framework.
Meanwhile I discovered another bug in FR. Handling of 1:1 sub-objects is not quite correct yet. Here's how to reproduce it:
1. Open my sample project (update references to FastReport)
2. Note that I have two address objects: One pointing to Country "Switzerland" and one to "Germany"
3. Run the example
4. Open the "TestReport" and preview it: You'll see that BOTH address lines display "Switzerland" as their country, which is incorrect (the second one should be "Germany")
5. Now open "TestReportWithSorting" and try to preview it: You get an error message. The only difference in this report is that I tried to sort the "Addresses" collection by the subproperty "Country.Name".
Remark: When you're working on the sorting/displaying of sub-properties, please also consider that 1:1 subobjects could be "null". I suppose that in this case FR should just display "string.empty" for strings, zero for numbers, "nothing" for dates, etc. I didn't try this yet, so maybe you've already implemented this.
Last but not least I have a "wish": Do you think it is possible for you to add support for the "Guid" type? It would be sufficient for me if you treated it as a string (using the ToString() method). The reason is simple: If I ever want to do a master-detail on two collections of objects, the Guid would be the key property to connect them in FR.
Wow, that's a lot.
Thank you so much in advance!
Regards
Marco
I've already made a huge step forward in integrating FastReport with XAF. The module is in beta stage. I'm waiting for DevExpress to fix a few bugs in their framework.
Meanwhile I discovered another bug in FR. Handling of 1:1 sub-objects is not quite correct yet. Here's how to reproduce it:
1. Open my sample project (update references to FastReport)
2. Note that I have two address objects: One pointing to Country "Switzerland" and one to "Germany"
3. Run the example
4. Open the "TestReport" and preview it: You'll see that BOTH address lines display "Switzerland" as their country, which is incorrect (the second one should be "Germany")
5. Now open "TestReportWithSorting" and try to preview it: You get an error message. The only difference in this report is that I tried to sort the "Addresses" collection by the subproperty "Country.Name".
Remark: When you're working on the sorting/displaying of sub-properties, please also consider that 1:1 subobjects could be "null". I suppose that in this case FR should just display "string.empty" for strings, zero for numbers, "nothing" for dates, etc. I didn't try this yet, so maybe you've already implemented this.
Last but not least I have a "wish": Do you think it is possible for you to add support for the "Guid" type? It would be sufficient for me if you treated it as a string (using the ToString() method). The reason is simple: If I ever want to do a master-detail on two collections of objects, the Guid would be the key property to connect them in FR.
Wow, that's a lot.
Thank you so much in advance!
Regards
Marco
Comments
Thanks for the test project.
Due to some reason, XAF returns the Address.Country property type descriptor as IEnumerable. I think it is internal logic of XAF. But I cannot distinguish between 1:1 properties and lists. I think I will add another event that you will use to return correct property metadata.
Regarding the GUID: it is possible now to get a column value of Guid type and convert it to string:
[Table.GuidColumn].ToString()
When FR asks XAF to get property descriptors for the particular object, XAF returns own property descriptors, instead of real properties of your object. Looks like XAF descriptors are used to support internal logic. For example, if you want Address.Country property, you will get XAF descriptor telling you that it is XPCollection property (instead of property of "Country" type)! That's why you see Country element in the Data tree as a datasource, but in "real word" it is just a nested property.
To solve this problem, I corrected the FilterProperties event handler so it will be able to replace the property descriptor returned by XAF with real property of your object. The fixed version will be available in 7 hours. Here is a code of new event handler:
Thank you so much for looking into this and extending the FilterProperty event! I'm looking forward to the update.
It's really strange what they do in XAF... I hope this is the last weird thing I had to bother you with for some time. :-)
Regards
Marco
Regards
Marco