private ParameterExpression GetMappingDataObject(ObjectMapperData parent) { var mdType = typeof(IObjectMappingData <,>).MakeGenericType(SourceType, TargetType); var variableNameIndex = default(int?); while (parent != null) { if (parent.MappingDataObject.Type == mdType) { variableNameIndex = variableNameIndex.HasValue ? (variableNameIndex + 1) : 2; } parent = parent.Parent; } var mappingDataVariableName = string.Format( CultureInfo.InvariantCulture, "{0}To{1}Data{2}", SourceType.GetShortVariableName(), TargetType.GetShortVariableName().ToPascalCase(), variableNameIndex); var parameter = Expression.Parameter(mdType, mappingDataVariableName); return(parameter); }