StrataFrame Forum

BusinessObjectLayer.ParentBusinessObject become NULL in Field_FieldName_Descriptor

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

By Chan - 1/18/2008

Hi,

I faced problem that BO.ParentBusinessObject become null in BO.FieldPropertyChanged event. After some debugging, I found that, BO.ParentBusinessObject is already become null in Field_FieldName_Descriptor.SetValue(). Once I leave this method, the ParentBusinessObject "came back".



Any ideas? Anyone able to access ParentBusinessObject in FieldPropertyChanged without problem?



Thank you
By StrataFrame Team - 1/21/2008

Are you using the business object within a grid with the BusinessBindingSource?
By Chan - 1/21/2008

Yes.
By StrataFrame Team - 1/21/2008

For business objects to work properly with a grid, we had to create the BusinessBindingSource, which creates a new instance of the business object for each record that is accessed through the BusinessBindingSource... these business objects all share a common DataTable internally (so they all look like they're the same business object).  Most likely, when you see a reference to ParentBusinessObject that is empty, the business object you are referencing is one that has been created by the BusinessBindingSource.  So, I think we simply need to set the ParentBusinessObject property on each business object that is created by the BusinessBindingSource... and I don't think it's doing that right now.