//migrate to PropertyMapFactory
        private static PropertyMap CreatePropertyMap <TSrc, TDest>(string srcPropertyName, string destPropertyName)
        {
            var factory = new TypeMapFactory();

            PropertyMap propertyMap = new PropertyMap(
                typeof(TDest).GetProperty(destPropertyName),
                factory.CreateTypeMap(typeof(TSrc), typeof(TDest),
                                      new MapperConfigurationExpression()));

            propertyMap.ChainMembers(new[] { typeof(TSrc).GetProperty(srcPropertyName) });
            return(propertyMap);
        }
        public static PropertyMap CreateReal(Type srcType, Type destType,
                                             string srcPropertyName, string destPropertyName, MapperConfigurationExpression options)
        {
            var factory = new TypeMapFactory();

            var typeMap = factory.CreateTypeMap(srcType, destType, options);

            PropertyMap propertyMap = new PropertyMap(destType.GetProperty(destPropertyName), typeMap);

            propertyMap.ChainMembers(new[] { srcType.GetProperty(srcPropertyName) });

            return(propertyMap);
        }
Exemplo n.º 3
0
        public void AddPropertyMap(IMemberAccessor destProperty, IEnumerable<IMemberGetter> resolvers)
        {
            var propertyMap = new PropertyMap(destProperty, this);

            propertyMap.ChainMembers(resolvers);

            _propertyMaps.Add(propertyMap);
        }
Exemplo n.º 4
0
        public void AddPropertyMap(MemberInfo destProperty, IEnumerable<MemberInfo> resolvers)
        {
            var propertyMap = new PropertyMap(destProperty, this);

            propertyMap.ChainMembers(resolvers);

            _propertyMaps.Add(propertyMap);
        }