Debugging recursive save with Adapter

Posts   
 
    
KL
User
Posts: 11
Joined: 31-Aug-2006
# Posted on: 12-Apr-2007 21:43:13   

Hi,

I'm getting a strange behaviour and could use help as to how to debug the issue.

Basically, I have an entity with various related entities. When I use the following to save a new entity: Adapter.SaveEnitity(modifiedEntity, True, True) <-- refetch and recursive Two insterts for modifiedEntity are attempted, one with all the fields null'd (or default values) except for one (which is a foreign key to a related entity that was changed prior to saving). I can see this happening by looking at the debug output, but can't figure out why the second insert is occuring...

All I know is it's because I'm recursively saving (if i set the 3rd/recursive parameter to False, then the second insert does not occur). Anyone have any tips for me that would help me debug this to figure out the "route" that's taken that would cause this second insert to occur? (i.e. figure out which related entity is causing this second insert to occur).

I'm not sure if I'm explaining things clearly, but any suggestions or help would greatly be appreciated.

BTW, I'm using LLBLGen 2.0

TIA

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Apr-2007 11:33:12   

Two insterts for modifiedEntity are attempted, one with all the fields null'd (or default values) except for one (which is a foreign key to a related entity that was changed prior to saving). I can see this happening by looking at the debug output, but can't figure out why the second insert is occuring...

Recursive saves, save the main entity and its dirty related entities. So as far as I understand your scenario, this is what happens.

If I don't understand you correctly, would you please post a complete code snippet. Thanks

Posts: 254
Joined: 16-Nov-2006
# Posted on: 14-Apr-2007 22:50:46   

You could certainly make the ORMPersistenceExecution trace switch verbose in it's output to see how the recursive save effects other entities.

e.g.

<system.diagnostics>
    <switches>
        <add name="ORMPersistenceExecution" value="4" />
    </switches>
</system.diagnostics>

There are a variety of other trace switches documented which may also be useful however I would start with this one initially.