If a binding model has [MapToParent] on a property which maps to an object with a [MapToParent] on one of its properties, that grandchild property will be prefixed with the parent's property name, but not the grandparent's property name.
Example
record Location(
string City,
string State
);
record Contact(
string Name,
[MapToParent] Location Location
);
record Request(
[MapToParent] Contact PrimaryContact,
[MapToParent] Contact SecondaryContact
);
In this case, when Request is mapped through the ReverseTopicMappingService, it will end up with:
PrimaryContactName
LocationCity
LocationState
SecondaryContactName
LocationCity (collision)
LocationState (collision)
Instead, the [MapToParent] on Contact should inherit the attributePrefix from the parent's [MapToParent] so you end up with:
PrimaryContactName
PrimaryContactLocationCity
PrimaryContactLocationState
SecondaryContactName
SecondaryContactLocationCity
SecondaryContactLocationState
Explicit attributePrefix
This should happen even if an attributePrefix is explicitly declared on the nested [MapToParent] property. So if you had:
record Contact(
string Name,
[MapToParent("")] Location Location
);
Then that should output:
PrimaryContactName
PrimaryContactCity
PrimaryContactState
SecondaryContactName
SecondaryContactCity
SecondaryContactState
If a binding model has
[MapToParent]on a property which maps to an object with a[MapToParent]on one of its properties, that grandchild property will be prefixed with the parent's property name, but not the grandparent's property name.Example
In this case, when
Requestis mapped through theReverseTopicMappingService, it will end up with:PrimaryContactNameLocationCityLocationStateSecondaryContactNameLocationCity(collision)LocationState(collision)Instead, the
[MapToParent]onContactshould inherit theattributePrefixfrom the parent's[MapToParent]so you end up with:PrimaryContactNamePrimaryContactLocationCityPrimaryContactLocationStateSecondaryContactNameSecondaryContactLocationCitySecondaryContactLocationStateExplicit
attributePrefixThis should happen even if an
attributePrefixis explicitly declared on the nested[MapToParent]property. So if you had:Then that should output:
PrimaryContactNamePrimaryContactCityPrimaryContactStateSecondaryContactNameSecondaryContactCitySecondaryContactState