Ejemplo n.º 1
0
        public string[] GetUnmappedPropertyNames()
        {
            var autoMappedProperties = _propertyMaps.Where(pm => pm.IsMapped())
                                       .Select(pm => pm.DestinationProperty.Name);
            var inheritedProperties = _inheritedMaps.Where(pm => pm.IsMapped())
                                      .Select(pm => pm.DestinationProperty.Name);

            var properties = _destinationType.GetPublicWriteAccessors()
                             .Select(p => p.Name)
                             .Except(autoMappedProperties)
                             .Except(inheritedProperties);

            return(properties.Where(memberName => !IgnorePropertiesStartingWith.Any(memberName.StartsWith)).ToArray());
        }
Ejemplo n.º 2
0
        public string[] GetUnmappedPropertyNames()
        {
            Func <PropertyMap, string> getFunc =
                pm =>
                ConfiguredMemberList == MemberList.Destination
                        ? pm.DestinationProperty.Name
                        : pm.CustomExpression == null && pm.SourceMember != null
                            ? pm.SourceMember.Name
                            : pm.DestinationProperty.Name;
            var autoMappedProperties = _propertyMaps.Where(pm => pm.IsMapped())
                                       .Select(getFunc).ToList();
            var inheritedProperties = _inheritedMaps.Where(pm => pm.IsMapped())
                                      .Select(getFunc).ToList();

            IEnumerable <string> properties;

            if (ConfiguredMemberList == MemberList.Destination)
            {
                properties = _destinationType.PublicWriteAccessors
                             .Select(p => p.Name)
                             .Except(autoMappedProperties)
                             .Except(inheritedProperties);
            }
            else
            {
                var redirectedSourceMembers = _propertyMaps
                                              .Where(
                    pm =>
                    pm.IsMapped() && pm.SourceMember != null &&
                    pm.SourceMember.Name != pm.DestinationProperty.Name)
                                              .Select(pm => pm.SourceMember.Name);

                var ignoredSourceMembers = _sourceMemberConfigs
                                           .Where(smc => smc.IsIgnored())
                                           .Select(pm => pm.SourceMember.Name).ToList();

                properties = _sourceType.PublicReadAccessors
                             .Select(p => p.Name)
                             .Except(autoMappedProperties)
                             .Except(inheritedProperties)
                             .Except(redirectedSourceMembers)
                             .Except(ignoredSourceMembers);
            }

            return(properties.Where(memberName => !IgnorePropertiesStartingWith.Any(memberName.StartsWith)).ToArray());
        }