private void OnEntitySetItemAddCompleted(object sender, EntitySetItemActionCompletedEventArgs e) { if (ShouldSkipRegistration(e)) { return; } RegisterChange(e.Item.State, e.Entity.State, null, e.Field.Associations.First()); }
private bool ShouldSkipRegistration(EntitySetItemActionCompletedEventArgs e) { if (!Session.DisableAutoSaveChanges) { return(true); } if (Session.IsPersisting) { return(true); } if (e.Exception != null) { return(true); } if (e.Field.Associations.First().IsPaired) { return(true); } return(false); }