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)); }
protected ConstructionDataInfo( TInvokable invokable, ConstructionKey key, int priority) { var parameters = invokable.GetParameters(); Priority = priority; ParameterCount = parameters.Length; _argumentTargetMembers = new QualifiedMember[ParameterCount]; ArgumentDataSources = new IDataSourceSet[ParameterCount]; CanBeInvoked = IsUnconditional = true; var mappingData = key.MappingData; var mapperData = mappingData.MapperData; for (var i = 0; i < ParameterCount; ++i) { var argumentMember = Member.ConstructorParameter(parameters[i]); var targetMember = _argumentTargetMembers[i] = mapperData.TargetMember.Append(argumentMember); var argumentMapperData = new ChildMemberMapperData(targetMember, mapperData); var argumentMappingData = mappingData.GetChildMappingData(argumentMapperData); var dataSources = ArgumentDataSources[i] = MemberDataSourceSetFactory .CreateFor(new DataSourceFindContext(argumentMappingData)); if (CanBeInvoked && !dataSources.HasValue) { CanBeInvoked = false; } if (IsUnconditional && dataSources.IsConditional && argumentMember.IsComplex) { IsUnconditional = false; } } }