Ejemplo n.º 1
0
        internal static TTarget MapCore <TSource, TTarget>(TSource source, TTarget target, int depth)
        {
            if (source == null || depth > mapperConfig.MaxDepth)
            {
                return(target);
            }
            TypePair pair   = TypePair.Create <TSource, TTarget>();
            IMapper  mapper = MapperUtil.GetMapper(pair);

            return((TTarget)mapper.Map(source, target, mapperConfig.ReferencePropertyHandle, depth + 1));
        }
Ejemplo n.º 2
0
        internal static IEnumerable <TTarget> MapCores <TSource, TTarget>(IEnumerable <TSource> source, int depth)
        {
            if (source == null || depth > mapperConfig.MaxDepth)
            {
                return(null);
            }
            TypePair pair   = TypePair.Create <TSource, TTarget>();
            IMapper  mapper = MapperUtil.GetMapper(pair);
            var      list   = new List <TTarget>();

            foreach (TSource item in source)
            {
                TTarget rst = (TTarget)mapper.Map(item, default, mapperConfig.ReferencePropertyHandle, depth + 1);