public static bool TargetMemberIsUnmappable <TTMapperData>( this TTMapperData mapperData, QualifiedMember targetMember, Func <TTMapperData, IEnumerable <ConfiguredDataSourceFactory> > configuredDataSourcesFactory, UserConfigurationSet userConfigurations, out string reason) where TTMapperData : IBasicMapperData { if (targetMember == QualifiedMember.All) { reason = null; return(false); } if ((mapperData.TargetType != mapperData.SourceType) && targetMember.LeafMember.IsEntityId() && !userConfigurations.MapEntityKeys(mapperData) && configuredDataSourcesFactory.Invoke(mapperData).None()) { reason = "Entity key member"; return(true); } return(targetMember.IsUnmappable(out reason)); }
public static bool TargetMemberIsUnmappable <TTMapperData>( this TTMapperData mapperData, QualifiedMember targetMember, Func <TTMapperData, IEnumerable <ConfiguredDataSourceFactory> > configuredDataSourcesFactory, UserConfigurationSet userConfigurations, out string reason) where TTMapperData : IBasicMapperData { if (targetMember == QualifiedMember.All) { reason = null; return(false); } if (!targetMember.LeafMember.IsEntityId() || userConfigurations.MapEntityKeys(mapperData) || configuredDataSourcesFactory.Invoke(mapperData).Any()) { return(targetMember.IsUnmappable(out reason)); } // If we're here: // 1. TargetMember is an Entity key // 2. No configuration exists to allow Entity key Mapping // 3. No configured data sources exist if (mapperData.RuleSet.Settings.AllowCloneEntityKeyMapping && (mapperData.SourceType == mapperData.TargetType)) { return(targetMember.IsUnmappable(out reason)); } reason = "Entity key member"; return(true); }