public TTo Map(TFrom?from, IObjectMapperResolver resolver)
        {
            if (from == null)
            {
                return(null);
            }

            return(resolver.GetMapper <TFrom, TTo>().Map(from.Value, resolver));
        }
        public TTo Map(TFrom?from, IObjectMapperResolver resolver)
        {
            if (from == null)
            {
                throw new ArgumentNullException("`from` is null but `to` does not allow null.");
            }

            return(resolver.GetMapper <TFrom, TTo>().Map(from.Value, resolver));
        }
Esempio n. 3
0
        public static IObjectMapper <TFrom, TTo> GetMapperWithVerify <TFrom, TTo>(this IObjectMapperResolver resolver)
        {
            IObjectMapper <TFrom, TTo> mapper = null;

            try
            {
                mapper = resolver.GetMapper <TFrom, TTo>();
            }
            catch (TypeInitializationException ex)
            {
                UnwrapThrow(ex);
            }

            if (mapper == null)
            {
                ThrowWhenNull <TFrom, TTo>(resolver);
            }

            return(mapper);
        }
 public TTo?Map(TFrom from, IObjectMapperResolver resolver)
 {
     return(resolver.GetMapper <TFrom, TTo>().Map(from, resolver));
 }