Hi all. Long time no post.
Using ver 2.0 and adapter.
Within the ValidateEntityBeforeSave(involvedEntity) I'm running the following code:
psuedocode:
public void SaveEntity()
{
... ParentEntity.Fields.EntityState = Fetched
... ParentEntity.ChildEntity.Fields.EntityState = "New", ChildEntity.IsNew, IsDirty = true, ChildEntity.KeyField = 0 (unassigned, database auto-generated key value)
}
public override ValidateEntityBeforeSave(IEntityCore involvedEntity)
{
foreach (ChildEntity child in involvedEntity.Children)
{
if (child.aProperty == x) do a thing... // ORMOutOfSyncError!!!!
// Now: child.Fields.EntityState = OutOfSync, Child.IsNew, IsDirty = false
// Now. child.KeyField = aValue ! An auto-value has been assigned
}
}
Oops! Generating an OutOfSync error. It appears that NEW (child.IsNew = true) children records are being SAVED prior to the ValidateEntityBeforeSave() call. Child.IsNew and IsDirty changes from true to false.
!! Interesting: ChildField.KeyField gets assigned a value from the db (autoincrement = true). But, ORMOutOfSync generates an error and an apparent rollback, because the new keyValue does NOT appear in the DB.
Please be assured that my code is not touching the Children Records after SaveEntity() is called. There are no other persistence calls made after SaveEntity().
Does LLBLGen perform an interim persistence call to children records in some sort of transaction?
Thanks!!!!
Jeff