Is there a way to have AutoMapper infer target type?

54 views
Skip to first unread message

Jean-Francois Picard

unread,
Mar 24, 2016, 2:13:36 PM3/24/16
to AutoMapper-users
Is there a way to use AutoMapper without having to tell it what the target type should be?

In the example below, could it infer that a T1 is always mapped to a T2?

Mapper.CreateMap<T1, T2>().ReverseMap();
Mapper.CreateMap<T3, T4>().ReverseMap();

T1 sourceObject = new T1();
T2 targetObject = Map(sourceObject);


Jimmy Bogard

unread,
Apr 15, 2016, 8:38:16 PM4/15/16
to automapp...@googlegroups.com
You could write an extension method I suppose?
--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages