Composite objects

Topics: General Discussion Forum, July and December Releases Forum
Mar 23, 2007 at 5:43 PM
Edited Mar 23, 2007 at 8:27 PM

in short: what is the preferred way to load/save composite objects in wssf/daab?

In detail: I have ie. a product with properties. I think the possibly places for saving composite objects are the

Busines layer
BL calls Add() method per object (TransactionScope created).

  • PropertyRepositoryrep=RepositoryFactory.Property();
  • product.Properties.ForEach(delegate(Propertyp){
  • rep.Save(p);});
  • ...

Pro: easy
Contra: performance and design trade offs

Data layer
Variation A
Items in the Properties collection has an ProductID. In this way we can easily use the gax generated stored procedures.

Pro: easy to use, performance ok
Contra: I hate this approach, xBase legacy

Data layer
Variation B
Pure Property objects in the Properties collection. But because of IInsertFactory it's not possible to override the ConstructInsert method. How can I say that "Hey you property, this is your product." ?

Pro: pure objects, more oop design
Contra: how to implement?

Perhaps not impossible solution to write handlers to fill/save objects when neccessary. Like in AspectJ an data access aspect which fills up domain object's properties lazy.

Any suggestion? Anybody?
Mar 27, 2007 at 3:45 PM
I hope that the new wcf hol will solve this problem too...I keep my fingers crossed:)