Businiess object relations

Businiess object relations

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


pillesoft posted on Monday, March 17, 2008

Dear Experts,

i have the following tables, and business objects too.
WorkPackage
    it has a subcontractor property to the Subcontractor object
Subcontractor
    it has an address property to the Address object

the WorkPackage object is a hierarchical object, so it has additionaly a List<Workpack> collection containing the child Work packages.

i would like to ask what is the best way to get the Work Packages as a BusinessListBase.
scenario 1:
collects all Address as Readonly objects, collecting them in a readonlybase collection
same for Subcontractors
every Subcon object address property should be assigned to the relevant Address object from the readonly collection
then retreive all records from workpack table and assign subcon property to the relevant Subcontractor object from the readonly collection.
scenario 2:
retreive all records from workpack table, based on subcon_id call relevant stored proc, and create new Subcon object, assign it to the subcon property
but when i create Subcon object based on its address_id field i should create a new Address object, and assign it to the Subcon object address property.

i hope you could understand, sorry for my poor english.

what do you think how should i handle this object relations. i think in scenario2 there are many db call.

thank you
Ivan

pillesoft replied on Tuesday, March 18, 2008

is there any problem with this question?
or why nobody answered it?

triplea replied on Tuesday, March 18, 2008

Hi Ivan

You could see Rocky's DeepData example. It gives a lot of different options for loading parent/child/grandchild data so you can pick the one that suits you best.

http://www.lhotka.net/cslacvs/viewvc.cgi/samples/trunk/DeepData/

pillesoft replied on Tuesday, March 18, 2008

thank you for the information
i've downloaded the complete samples trunk, i start to overview them

Ivan

Copyright (c) Marimer LLC