turn of saving recursive for one child

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 30-Jun-2009 20:50:00   

Greetings,

I'd like to ask about turn of saving recursive for one child of Children entities

Ex. I have an entity 'A' this entity has relation with 3 tables 'AA', 'AB', and 'AC' all relation 1 :m

when fill entity 'A' its fill with prefetchPath to that 3 tables

my problem

How to save Entity 'A' recursively without 'AC' collection avoiding to switch recursive flag to false for adapter.save method ???

llblgen version 2.6 adapter mode Sql2008 V.S 2008 C#

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 30-Jun-2009 21:38:42   

Set the AC collection to null, or remove all of the entities from it before the save ?

Don't forget that removing items from a collection has no (automatic) effect on the database, LLBLGen makes no assumptions about whether you want to delete them or not.

Matt

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 30-Jun-2009 22:32:57   

can't set 'AC' collection property to null, Its READONLY...

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 30-Jun-2009 22:35:15   

The AC.RemoveAll will prevent the entities being saved.

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 01-Jul-2009 13:09:24   

Hi Matt,

thanks..for replay...

Really.. I use AEntity.ACCollection.Clear(), But still the AcCollection has an empty Entity inside it

Note, The AcCollection is a Entity collection mapped to view. and in designer, I made relation to AEntity

after that when save AEntity it throw an exception that view can't be updatable although using AEntity.ACCollection.Clear().

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 01-Jul-2009 14:18:11   

I use AEntity.ACCollection.Clear(), But still the AcCollection has an empty Entity inside it

Can't be, please check the AEntity.ACCollection.Count property.

after that when save AEntity it throw an exception that view can't be updatable although using AEntity.ACCollection.Clear().

Most probably someOther entity in the graph is holding a reference to an ACEntity.

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 01-Jul-2009 14:54:20   

after that when save AEntity it throw an exception that view can't be updatable although using AEntity.ACCollection.Clear().

Most probably someOther entity in the graph is holding a reference to an ACEntity.

you are right.. As i have too complex logic i found one reference it

thanks...