public bool MapDestinationPropertyToSource(IProfileConfiguration options, TypeDetails sourceType, Type destType, string nameToSearch, LinkedList <IValueResolver> resolvers, IMemberConfiguration parent)
        {
            string[] matches = DestinationMemberNamingConvention.SplittingExpression
                               .Matches(nameToSearch)
                               .Cast <Match>()
                               .Select(m => SourceMemberNamingConvention.ReplaceValue(m))
                               .ToArray();
            MemberInfo matchingMemberInfo = null;

            for (int i = 1; i <= matches.Length; i++)
            {
                NameSnippet snippet = CreateNameSnippet(matches, i);

                matchingMemberInfo = parent.NameMapper.GetMatchingMemberInfo(sourceType, destType, snippet.First);

                if (matchingMemberInfo != null)
                {
                    resolvers.AddLast(matchingMemberInfo.ToMemberGetter());

                    var foundMatch = parent.MapDestinationPropertyToSource(options, TypeMapFactory.GetTypeInfo(matchingMemberInfo.GetMemberType(), options), destType, snippet.Second, resolvers);

                    if (!foundMatch)
                    {
                        resolvers.RemoveLast();
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(matchingMemberInfo != null);
        }
Ejemplo n.º 2
0
 public TypeDetails GetTypeInfo(Type type)
 {
     return(TypeMapFactory.GetTypeInfo(type, GetProfile(DefaultProfileName)));
 }