private bool CannotBeReversed(out QualifiedMember targetMember, out string reason) { if (ValueCouldBeSourceMember == false) { targetMember = null; reason = $"configured value '{DataSourceLambda.GetDescription(ConfigInfo)}' is not a source member"; return(true); } if (ConfigInfo.HasCondition) { targetMember = null; reason = $"configuration has condition '{ConfigInfo.GetConditionDescription()}'"; return(true); } if (!TargetMember.IsReadable) { targetMember = null; reason = $"target member '{GetTargetDescription()}' is not readable, so cannot be used as a source member"; return(true); } if (!DataSourceLambda.TryGetSourceMember(out var sourceMemberLambda)) { targetMember = null; reason = $"configured value '{DataSourceLambda.GetDescription(ConfigInfo)}' is not a source member"; return(true); } targetMember = sourceMemberLambda.ToTargetMemberOrNull( SourceType, ConfigInfo.MapperContext, out reason); if (targetMember != null) { return(false); } var sourceMember = sourceMemberLambda.ToSourceMember(ConfigInfo.MapperContext); var sourceMemberPath = sourceMember.GetFriendlySourcePath(ConfigInfo); reason = $"source member '{sourceMemberPath}' is not a useable target member. {reason}"; return(true); }
protected string GetDataSourceValueDescription() { var description = DataSourceLambda.GetDescription(ConfigInfo); return(DataSourceLambda.IsSourceMember ? description : "'" + description + "'"); }