Fix Navigation Property Update When Changing a Composite Foreign Key
In an entity that has a navigation property based on a composite foreign key (i.e. based on more than one foreign key properties), when setting one of the FK properties, breezejs tries to update the navigation property, however it searches for the foreign entity using a single key instead of a composite key, so it never finds the property.
To see what I mean and for a possible fix, please refer to breeze.debug.js (v.1.4.8) lines 4907 and 4908:
key = new EntityKey(relatedNavProp.entityType, [newValue]);
relatedEntity = entityManager.findEntityByKey(key);
The related entity never gets found since the key consists only of a single value [newValue] instead of the multiple values defined by the multiple foreign key properties.
Daniel Olteanu commented
Really annoying thing. Please fix.
Seems like an easy fix.