How to get DitryEntities of contained entitycollections

Posts   
 
    
tolga
User
Posts: 25
Joined: 26-Feb-2006
# Posted on: 03-Mar-2006 00:03:27   

Hi,

I would like to implement a convenience functionality in my GUI that saves all the dirty objects of the primary entitycollection as well as all of the dirtyentities of contained entitycollections.

For example, let's say EntityCollection ec1 contains object ec11 of class type Entity1.

Class Entity1 has an EntityCollection member ec2 of class type Entity2. when I do:

        DataAccessAdapter da = new DataAccessAdapter();
        da.SaveEntity(ec11, false, true);

I'd like to not only save ec11 but also all dirty entities of ec11.ec2.

Is there any way to actually find all the dirty entities of a refrenced entitycollections?

This way I can create a method that can return all master entities (that are dirty or contain collections with dirty entities) and call the SaveEntityCollection method with the recurse=true parameter.

If I use the SaveEntityCollection on the full collection(which potentially has thousands of entries) I will have added significant unnecessary burden on the serialization layer (of my tiers)...

Thanks

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 03-Mar-2006 04:14:10   

The recurse parameter of SaveEntity defaults to true. And it's only saving entities that are dirty.

tolga
User
Posts: 25
Joined: 26-Feb-2006
# Posted on: 03-Mar-2006 20:14:47   

Hi,

I understand that - when I have an EntityCollection of records with multiple PrefetchPaths and I edit some of the objects in the prefetchpaths through databinding (or whatever) but don't edit the top level record in the main entitycollection, DirtyEntities (I think) is empty. I'd like to figure out a way to get unchanged master objects that have changed detail objects.

The reason why I would want to do this is: if I have an entitycolelction with 1000 objects (and prefetchpaths) in a disconnected scenarios, I could send back all 1000 object to the server and call the entitycollection with the recurse parameter set to true.

This method creates an unnecessary burden. I just want to send the changed objects.

This is for a disconnected/web service like scenario where exntitycollections are being serialized back and forth.

Perhaps, I explained this a little better in my other (duplicate) post: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=5541