private static IMemberPopulator Create(QualifiedMember targetMember, IObjectMappingData mappingData)
        {
            var childMapperData = new ChildMemberMapperData(targetMember, mappingData.MapperData);

            if (childMapperData.TargetMemberIsUnmappable(out var reason))
            {
                return(MemberPopulator.Unmappable(childMapperData, reason));
            }

            if (TargetMemberIsUnconditionallyIgnored(
                    childMapperData,
                    out var configuredIgnore,
                    out var populateCondition))
            {
                return(MemberPopulator.IgnoredMember(childMapperData, configuredIgnore));
            }

            var childMappingData = mappingData.GetChildMappingData(childMapperData);
            var dataSources      = DataSourceFinder.FindFor(childMappingData);

            if (dataSources.None)
            {
                return(MemberPopulator.NoDataSource(childMapperData));
            }

            return(MemberPopulator.WithRegistration(childMappingData, dataSources, populateCondition));
        }
Beispiel #2
0
        private static IMemberPopulator Create(MemberPopulationContext context)
        {
            if (TargetMemberIsUnmappable(context, out var reason))
            {
                return(MemberPopulator.Unmappable(context, reason));
            }

            if (context.TargetMemberIsUnconditionallyIgnored(out var populateCondition))
            {
                return(MemberPopulator.IgnoredMember(context));
            }

            var dataSourceFindContext = context.GetDataSourceFindContext();
            var dataSources           = DataSourceSetFactory.CreateFor(dataSourceFindContext);

            if (dataSources.None)
            {
                return(MemberPopulator.NoDataSource(context));
            }

            return(MemberPopulator.WithRegistration(dataSources, populateCondition));
        }