KeyFieldIsUniqueInCollectionConstraint fails for a new object because @@IDENTITY returns a DECIMAL and there is an equality test with the value from the database for usually an INT field. Therefore (DECIMAL)1 and INT(1) are not considered equal and the constraint incorrectly fails.
This does not affect situations where the object is reloaded and then saved because the DistinctValue will be of the correct INT type.
Corrects KeyFieldsIsUniqueInCollectionContraint when used with a save…
…d (not reloaded) object. Closes #88.