Child objects and XML data update problem

Child objects and XML data update problem

Old forum URL:

j0552 posted on Wednesday, July 31, 2013


I have an editable root object with a child list. The children are populated from xml data. When I hit save I need to rebuild the xml data from the children. The problem I'm having is with adding back items where the children are not dirty.

I can call MarkDirty in Child_Fetch but this makes the root dirty even if nothing else has changed.

I could build the whole xml from the root by looping through the child list but this is not very elegant either.

This seem like it could be a common problem. Can you tell me the best CSLA way to deal with this?



JonnyBee replied on Wednesday, July 31, 2013

I´m not quite sure I understand what the problem is?

skagen00 replied on Wednesday, July 31, 2013

I had a problem similar to this.

Basically a child's overall source was XML and needed to be persisted back as such.  I wanted to manipulate aspects of the XML and it was a legacy piece of XML containing settings and such that I have to preserve and don't need to understand.

What I ended up doing is to keep not just the properties that came forth from that XML as managed properties of the child but I also kept the XML string as a managed property of the child.  It didn't add that much weight to my child objects in my case.

With PropertyHasChanged I would capture changes to the various properties and just manipulate the appropriate aspects of the XML.  When the business object was saved, I had the XML.

Basically I kept an internal mapping of PropertyInfo to where it went in the XML.

Copyright (c) Marimer LLC