Ejemplo n.º 1
0
 public static TTarget Map <TSource, TTarget>(this TSource source, ObjectMapper <TSource, TTarget> mapper)
     where TSource : class
     where TTarget : class, new()
 {
     _ = mapper ?? throw new ArgumentNullException(nameof(mapper));
     return(source == null ? null : mapper.BuildConvertFunc().Invoke(source));
 }
Ejemplo n.º 2
0
 public static IEnumerable <TTarget> Map <TSource, TTarget>(this IEnumerable <TSource> sources,
                                                            ObjectMapper <TSource, TTarget> mapper)
     where TSource : class
     where TTarget : class, new()
 {
     _ = mapper ?? throw new ArgumentNullException(nameof(mapper));
     return(sources?.Select(mapper.BuildConvertFunc()));
 }