Matching conventions

Matching conventions

While searching for a match between source and target, MappingGenerator always uses case-insensitive comparison mode. Additionally, all underscore characters are removed from the names before the comparison. To find a best match the following matching strategies are executed in order:

1) Direct mapping When property/field names match directly: csharp target.FirstName = source.FirstName; target.LastName = source.LastName; 2) Mapping Method Call-To-Property When method name ends with target name:

```csharp
target.Total = source.GetTotal()
```

3) Flattening with sub-property When the path matches the target name: csharp target.UnitId = source.Unit.Id 4) Expanding acronyms

```csharp
UserName = u.Name
```

5) ⭐ Flattening

When sub-property name matches the target name:

```cs
City = s.MainAddress.City
```

This strategy is used when the `Allow for type flattening` option is enabled (available only in paid version).

6) ⭐ Congruent matching

Trying to match a source to target as a prefix or suffix like t.X = s.XSuffix)

```cs
City = s.CityValue
```

This strategy is used when the `Allow for congruent matching` option is enabled (available only in paid version).