WriteXml without recurse

Posts   
 
    
Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 07-Jul-2010 16:08:06   

Hi

I'm using:

LLBLGen 2.6 Final released October, 9, 2009. Adapter classes. VS2010 .Net 3.5

Is there any way to make an entity's WriteXml method not write the entire object graph recursively?

I'm trying to save an entity's XML in the AuditDeleteOfEntity method when deleting an entity. However, it's writing the XML for the entire object graph I fetched, instead of just the root entity.

Thank you!

PS: Holding thumbs for Nederland in the World Cup. wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 08-Jul-2010 11:53:43   

That's not possible with the current framework code: it traverses over the complete graph. If you need this, you should write the method yourself. You can do that by copying the code from Entity2Xml in the entity base class to a method in a partial class of the generated code and call that method instead. You of course have to alter the code a bit so it won't traverse in entity collections and entity references.

The method is quite long as it otherwise would fragment across many methods which would have been used only once.

Frans Bouma | Lead developer LLBLGen Pro
Jean-Paul
User
Posts: 19
Joined: 22-Sep-2006
# Posted on: 08-Jul-2010 14:21:15   

Hi Frans

Thank you for the advice. I will implement my own Entity2Xml then.

Kind regards

JP

PS: I won't hold the long method against you simple_smile