Exemplo n.º 1
0
        private IMapper GetTranslator(Type sourceType, Type destinationType, Type sourceDynamicType)
        {
            Type    currentSourceType = sourceDynamicType;
            IMapper mapper;

            do
            {
                mapper = configuration.GetTranslator(currentSourceType, destinationType);

                currentSourceType = currentSourceType.BaseType;
            } while (mapper == null && sourceType.IsAssignableFrom(currentSourceType));

            if (mapper == null)
            {
                throw new MapperNotFoundException(sourceType, destinationType);
            }
            return(mapper);
        }