Dynamics has some magic on these entities, that make it look like the address fields are directly held on the same entity, but really these entities store the primary key id of a seperate address entity which holds the address data, so really these are foreign keys, and dynamics crm automatically pulls the related address records into the current entity and exposes it in a flattened form by prefixing address field names with address1, then address2 etc etc.
When CrmAdo queries the metadata columns for an entity to get the column that is flagged with IsPrimary - the attribute that represents the primary key is returned, however so are these address1_id and address2_id columns. This is rubbish of the SDK. I will need to find some other filter criteria on which I can filter those foreign keys out so that CrmAdo's GetSchema methods doesn't report them as primary keys.
On certain entities in CRM, like
There are mutiple
address
fields.Dynamics has some magic on these entities, that make it look like the address fields are directly held on the same entity, but really these entities store the primary key id of a seperate
address
entity which holds the address data, so really these are foreign keys, and dynamics crm automatically pulls the related address records into the current entity and exposes it in a flattened form by prefixing address field names with address1, then address2 etc etc.When CrmAdo queries the metadata columns for an entity to get the column that is flagged with
IsPrimary
- the attribute that represents the primary key is returned, however so are theseaddress1_id
andaddress2_id
columns. This is rubbish of the SDK. I will need to find some other filter criteria on which I can filter those foreign keys out so that CrmAdo'sGetSchema
methods doesn't report them as primary keys.