Support foreign key reference using field names that differ from the object type

This is required for custom object references, since the reference field name must end in "__r" while the object type must end in "__c"