Avoiding update

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 13-May-2005 22:51:55   

Hi,

Lets say I create a new entity instance, set its primary key and mark it as not new.

If I'm going to call 'Save' on the entity, what is the best way to modify it prior to the save such that the save does nothing!

So you see, I want to call save on an entity and have no work done.

Ian.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-May-2005 11:18:35   

Ian wrote:

Hi,

Lets say I create a new entity instance, set its primary key and mark it as not new.

If I'm going to call 'Save' on the entity, what is the best way to modify it prior to the save such that the save does nothing!

So you see, I want to call save on an entity and have no work done. Ian.

You want to call a routine but you want it to do nothing? wink . In a recursive save you mean? Ok, besides the point why you would want to do this, you can set entity.Fields.IsDirty to false, and no save takes place.

Frans Bouma | Lead developer LLBLGen Pro
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 14-May-2005 17:23:19   

Yes, I want to have a parent entity and assign children to it and have the children updated properly but without modifying the parent.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-May-2005 17:34:13   

Ian wrote:

Yes, I want to have a parent entity and assign children to it and have the children updated properly but without modifying the parent.

If nothing is changed in the parent, it won't be saved. If something IS changed, it has to be saved obviously. The save code checks the Fields.IsDirty flag, so you can set taht to false and the entity won't be saved.

Frans Bouma | Lead developer LLBLGen Pro