private static Expression GetTargetValidCheckOrNull(Type targetType, IMemberMapperData mapperData) { if (!mapperData.TargetMember.IsReadable || mapperData.TargetIsDefinitelyUnpopulated()) { return(null); } var targetIsOfDerivedType = GetTargetIsDerivedTypeCheck(targetType, mapperData); if (mapperData.TargetIsDefinitelyPopulated()) { return(targetIsOfDerivedType); } var targetIsNull = mapperData.TargetObject.GetIsDefaultComparison(); var targetIsValid = Expression.OrElse(targetIsNull, targetIsOfDerivedType); return(targetIsValid); }