I created function but it works only for simple paths like:
Contact.Id => Record.Id
but it dont work with
Contact.PersonInformation.FirstName =will be mapped to> Record.FirstName
public (PropertyInfo propertyInfo, string path) GetDestinationPropertyFor(string sourcePropertyPath, Type salesforceType, Type swaggerType)
{
var properties = sourcePropertyPath.Split('.');
var destinationProperties = new List<string>();
PropertyInfo propertyInfo = null;
foreach (var property in properties)
{
var map = _mapper.FindTypeMapFor(salesforceType, swaggerType);
var propertyMap = map.PropertyMaps.First(pm => pm.DestinationMember == swaggerType.GetProperty(property));
propertyInfo = propertyMap.SourceMember as PropertyInfo;
var jsonProperty = propertyInfo.GetCustomAttribute(typeof(JsonPropertyAttribute));
destinationProperties.Add(((JsonPropertyAttribute)jsonProperty).PropertyName);