Binding Nested Objects in an Object Graph

Binding Nested Objects in an Object Graph

Old forum URL: forums.lhotka.net/forums/t/11471.aspx


AndrewR posted on Thursday, July 12, 2012

Hi All,

I am trying to create an object graph as follows:

I have a parent class named BBparent in which when I call BBparent.NewParent, I must also create a child BBchild. The child BBchild must then create two separate child objects; lets say BBchildA and BBchildB. BBchildA must then create a collection BLBcollectionA. BLBcollectionA must then create one or more child BBchildC. BBchildC must then create a new collection BLBcollectionB and then this collectiion must then create one ore more BBchildD. This is the object graph hierarchy:

BB

 |

BB__

 |       |

BB   BB

 |

BLB

 |

BB

 |

BLB

 |

BB

 Basically, when I call the BBparent.NewParent, that is turn causes all the other objects in the object graph to call their <object>.NewObject. And when I call BBparent.Save, I must save all the way though in a transaction, which by the way works (I have instantiate BBparent and set all properties by code in my test harness as part of testing).

My challenge is I have only one datasource BBparent on the page. However, I have several data aware controls; detailsview, gridview, formview and need to bind them to their own datasources in the object graph. However, because of the way I have one datasource as an object graph, I am not sure how to bind the controls to their individual datasources. Ideally, I would like to bind at design time.

I believe my need is not quite like any of the Project Tracker examples where the child creation is triggered by a user event. 

Am I doing this the wrong way? Is this too complicated? Any suggestions would greatly be appreciated.

I am using VS 2008, .Net 3.5 and CSLA 3.0 

Much thanks,

Andrew

Copyright (c) Marimer LLC