jeffkararo wrote:
I have the following
entityA
entityA.EntitiesB
I make some changes to the entities in the EntitiesB collection. I then perform the following:
entityA.EntitiesB = SaveEntityCollection(EntitiesB, true, false);
I get the following compile error:
Property or indexer 'entityA.EntitiesB' cannot be assigned to -- it is read only
Please consult the reference manual for details on adapter.SaveEntityCollection(). You'll there see it doesn't return the collection saved.
OK, fine. Then I try the following:
SaveEntityCollection(EntitiesB, true, false);
Compiles fine and runs but I get an Out-of-sync runtime error when I want to save again. I had thought that the SaveEntityCollection would refresh the entityCollection being passed as a parm but obviously not.
Here, finally, is my question. How do I refresh the entityA.EntitiesB collection after performing the SaveEntityCollection method?
It does call FetchEntity afterwards, though that can fail if for example you've defined the PK field in the db as 'identity' though haven't updated the project yet, or it's a GUID and gets a new value using NEWID in the db and you really should pass in a GUID value in the client.
Could you check that for me, please?
To have fine-grained checks on this, you can manually walk entitiesB and save each entity with adapter.SaveEntity() and pass in true for refetch and false for recurse, and check the return value. If it's false, the refetch failed.