private static IMemberPopulator Create(MemberPopulationContext context)
        {
            if (TargetMemberIsUnmappable(context, out var reason))
            {
                return(NullMemberPopulator.Unmappable(context, reason));
            }

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

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

            if (dataSources.None)
            {
                return(NullMemberPopulator.NoDataSources(context));
            }

            dataSourceFindContext.MemberMapperData.RegisterTargetMemberDataSources(dataSources);

            return(new MemberPopulator(
                       dataSources,
                       dataSourceFindContext.MemberMapperData,
                       populateCondition));
        }
Example #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));
        }