private EnumMappingMismatch( IQualifiedMember targetMember, IEnumerable <IQualifiedMember> sourceMembers, IList <string> mismatches, IMemberMapperData mapperData) { _rootMapperData = mapperData.GetRootMapperData(); _sourceMembers = sourceMembers; _mismatches = mismatches; TargetMemberPath = targetMember.GetFriendlyTargetPath(_rootMapperData); }
private static string GetMessage(IMemberMapperData mapperData) { if (mapperData == null) { return(NoMappingData); } var rootData = mapperData.GetRootMapperData(); var sourcePath = mapperData.SourceMember.GetFriendlySourcePath(rootData); var targetPath = mapperData.TargetMember.GetFriendlyTargetPath(rootData); return($"An exception occurred mapping {sourcePath} -> {targetPath} with rule set {mapperData.RuleSet.Name}."); }
internal static Expression GetFactoryMethodCall(IMemberMapperData mapperData, Expression exceptionVariable) { var rootData = mapperData.GetRootMapperData(); var sourcePath = mapperData.SourceMember.GetFriendlySourcePath(rootData); var targetPath = mapperData.TargetMember.GetFriendlyTargetPath(rootData); var mappingExceptionCreation = Expression.Call( _factoryMethod, mapperData.RuleSet.NameConstant, sourcePath.ToConstantExpression(), targetPath.ToConstantExpression(), exceptionVariable); return(mappingExceptionCreation); }
private EnumMappingMismatch( IQualifiedMember targetMember, IEnumerable <IQualifiedMember> sourceMembers, string[] mismatches, IMemberMapperData mapperData) { var rootMapperData = mapperData.GetRootMapperData(); var sourceMemberPaths = string.Join(" / ", sourceMembers.Select(sm => sm.GetFriendlySourcePath(rootMapperData))); var targetMemberPath = targetMember.GetFriendlyTargetPath(rootMapperData); var warningLines = mismatches .Prepend($"WARNING - enum mismatches mapping {sourceMemberPaths} to {targetMemberPath}:") .ToArray(); Warning = string.Join(Environment.NewLine, warningLines); }