Adding to EntityCollection is order always preserved

Posts   
 
    
crd
User
Posts: 2
Joined: 14-Mar-2007
# Posted on: 14-Mar-2007 13:30:18   

Hi

I have en EntityCollection which I add entities to. I need to be sure that the order in which the entities are added is preserved.

Course: 1. Add entities to an EntityCollection 2. Save the EntityCollection and refetch the entities to get the db generated ID 3. run through the EntityCollection and save the ID's

Can I be absolutely sure that the order is preserved when I read out the entities from the collection?

Thanks

Christian Rosenberg Dahm

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Mar-2007 13:52:05   
  1. run through the EntityCollection and save the ID's

I don't understand this step, where are you going to save the IDs?

Anyway if you save the EntityCollection with refetch, entities in the collection would be refetched in their same position. You can try it out.

crd
User
Posts: 2
Joined: 14-Mar-2007
# Posted on: 14-Mar-2007 13:56:32   

I need to save the ID's for further processing later on, so it is importent that the order is preserved.

It looks like the order is preserved, but I would like to have it verified, since the integrity of my system very much depends on it.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Mar-2007 14:16:29   

It is preserved. Entities are saved and fetched back one by one from the EntityCollection. And their location is not changed.