StrataFrame Forum

BusinessBindingSource

http://forum.strataframe.net/Topic5010.aspx

By Larry Caylor - 12/6/2006

I’m using BusinessBindingSource as a data source for Active Reports. Everything works fine as long as the Business Object that I’m assigning to BusinessBindingSource does not contain any custom properties. If I add a custom property, Active Reports does not map the report fields correctly.  This happens even if the custom properties are not being mapped to an Active Reports fields.  Just having the custom properties defined in the BO causes Active Reports to incorrectly map data. I’ve added the custom property descriptors using the GetCustomBindablePropertyDescriptors override and the BO works fine when binding to Windows forms. It appears that something is not working correctly when the custom properties are handeled by BusinessBindingSource.

-Larry

By StrataFrame Team - 12/6/2006

Does the report form throw an exception?  Or does the problem manifest itself in other ways?
By Larry Caylor - 12/6/2006

The report runs, but the information that appears in the fields is messed up. I haven’t looked at it fully in debug yet but it appears to try and use other elements within the BindingSource as data fields. See attachments. The only difference between the business objects that were used as the input to BindingSouce for both cases is the addition of four custom properties to the one that causes the error.  I’ve run into this before but just worked around it by eliminating the custom properties in the objects I use for reporting.

-Larry

By StrataFrame Team - 12/7/2006

That error is certainly strange... I wonder what mechanism ActiveReports is using... reflection, ITypedList, not sure.  Probably the only way to fix it would be to debug it.  You might try setting break points in the .Item property of the business object and the Gets of the properties that are being evaluated.
By Larry Caylor - 12/8/2006

I’ll give it a try when I get some free time. Unfortunately Active Reports does not include source code.  In the meantime I can work around the issue by creating additional BOs for reporting.

By Larry Caylor - 12/8/2006

Here is some additional information on the mechanism that Active Reports uses. According to Data Dynamics, any class that implements the IList interface may be used as a data source.
By Trent L. Taylor - 12/8/2006

Well then there should not be any issue because if you use the BusinessBindingSource to wrap a BO, then the IList interface is implemented.  We will look into this more, but this interface is implemented.
By Larry Caylor - 12/8/2006

That's what I thought. Just to give you a little more info, the custom properties that I've added are readonly and are populated by scalar methods, so there are no actual columns in the underlying data table.

-Larry

By Trent L. Taylor - 12/8/2006

Well, I will have to test this.  But basically what will happen is that the scalar method will be executed once for every row since the IList interface basically emits its own BO for each row so the strong-typing works properly.