Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In what methods does AutoMapper use reflection?

I wonder if AutoMapper uses reflection in its Mapper.Map<>() method, or if the use of reflection is limited to the Mapper.CreateMap<>() method?

like image 552
herbjorn Avatar asked Feb 13 '23 21:02

herbjorn


1 Answers

Neither, to be honest. When you call CreateMap, AutoMapper uses optimizers to build the code for getting/setting values on source/destination types. Currently, it uses a combination of Reflection.Emit and expression tree compilation. At Map time, it uses the optimized callbacks for interacting with types.

like image 113
Jimmy Bogard Avatar answered Feb 16 '23 04:02

Jimmy Bogard