Esempio n. 1
0
 protected virtual ValueMapper CreateMapper(Type sourceType, Type targetType)
 {
     if (HasOption(MemberMapOptions.Hierarchy))
     {
         ValueMapper mapper;
         if (EnumerableMapper.TryCreate(sourceType, targetType, _container, out mapper))
         {
             return(mapper);
         }
     }
     return(null);
 }
Esempio n. 2
0
        internal Action <TSource, TTarget> GetMapAction <TSource, TTarget>()
        {
            Compile();
            ValueMapper mapper;

            if (EnumerableMapper.TryCreate(typeof(TSource), typeof(TTarget), this, out mapper))
            {
                mapper.Compile(_moduleBuilder);
                return((Action <TSource, TTarget>)mapper.CreateDelegate(typeof(TSource), typeof(TTarget), _moduleBuilder));
            }

            var typeMapper = TypeMapper <TSource, TTarget> .GetInstance(this);

            typeMapper.SetReadOnly();
            typeMapper.Compile(_moduleBuilder);
            return(typeMapper.CreateMapper(_moduleBuilder));
        }