I have an Entity (Parent) with a 1:m relationship with another (Child)
When created,
Parent is created and saved
then, all the Child entries are created new, saved and then added to the collection
then, the Parent is then updated with a sum value from the Child records
and, saved again
All seems fine in the database... there are 228 child records and the sum field in the
parent equals the sum of the fields in the Child records.
But... if use the just created instance of the Parent and ForEach the Child recrods in the
Children collection there are 229 records, one greater than the expected 228. Note: the first record is repeated.
And... if I create an new instance of the Parent by creating from the database... everything is fine and there are 228 records in the Child collection.
What am I screwing up?
Thanks,
Ed