Description
Martin Francisco created an issue — 3rd August 2016, 1:31:43:
When initializing a dictionary for a ternary relationship and the reference to the key in the element is mapped with either the default or join fetch mode, then the keys are added to the dictionary before they are fully hydrated (Id only).
This causes a problem when the key entity has a custom Equals/GetHashCode because the hash code will be incorrect until it is fully hydrated. This would either cause an exception if GetHashCode was expecting a valid fully hydrated state, or all related element entities are added to the same key (since all the keys were added with the default state GetHashCode value).
Attached are tests that show that all children are added to the same key when the dictionary is hydrated.
When the mapping is explicitly set to use select fetch mode, then the keys are fully hydrated before being added to the dictionary.