CDM
CDM copied to clipboard
Fix reading the primary key property of resolved entities
This change fixes an issue where, when reading the PrimaryKey
property of an entity which was resolved from an abstract manifest (with the identifiedBy
purpose on an attribute), the value cannot be retrieved.
When FetchTraitReferenceArgumentValue
returns the value of the argument for the resolved is.identifiedBy
trait, it returns either a string
or a CdmAttributeReference
. However, the subsequent process was looking to cast to a CdmTypeAttributeDefinition
, which is not a compatible type. Since the only thing the code needs from that object is the name, it is safe to cast to the CdmObject
instead and call the underlying FetchObjectDefinitionName()
method.
This change makes the cast to CdmObject
and returns the value successfully.
A unit test which addresses this situation is also included in the changes.