SaveEntityCollection only saving the first item in collection

Posts   
 
    
Drakon
User
Posts: 6
Joined: 06-Oct-2014
# Posted on: 15-Oct-2014 13:02:24   

Hope someone can help. I am trying to update a collection of entities but only the first item is being persisted to the database. I am using LLBLGen Pro V4.2 Final


public void SavePersonnel(IEnumerable<PersonnelEntity> personnelEntities)
        {
            using (var adapter = new DataAccessAdapter())
            {
                var personnelToBeSaved = new EntityCollection<PersonnelEntity>(personnelEntities);

//              foreach (var personnel in personnelToBeSaved)
//                  adapter.SaveEntity(personnel, true, true);

                adapter.SaveEntityCollection(personnelToBeSaved, true, true);
            }
        }

I have inspected the entities at every stage and the all have IsDirty = true and the correct field marked up as changed.

After the SaveEntityCollection method has been called, only the first item in the collection has IsDirty set back to False and the field changed value set to false and is persisted to the database. The remainder all still have IsDirty = True.

Any ideas? disappointed

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Oct-2014 07:53:45   

Hi there.

I can't reproduce it. Could you reproduce it in a simple repro solution using Northwind? What version is your runtime library version? ( http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7720 )

David Elizondo | LLBLGen Support Team
Drakon
User
Posts: 6
Joined: 06-Oct-2014
# Posted on: 17-Nov-2014 14:15:46   

Hi Daelmo,

I couldn't reproduce it either and had to move onto another part of the project. I ended up using the commented out piece of code (the foreach loop) as this did the job.

Thanks for the response and apologies for lack of response on my part.