Understanding Your Mappings¶
AutoMapper creates an execution plan for your mapping. That execution plan can be viewed as an expression tree during debugging. You can get a better view of the resulting code by installing the ReadableExpressions VS extension. If you need to see the code outside VS, you can use the ReadableExpressions package directly. This DotNetFiddle has a live demo using the NuGet package, and this article describes using the VS extension.
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<Foo, Bar>()); var executionPlan = configuration.BuildExecutionPlan(typeof(Foo), typeof(Bar));
Be sure to remove all such code before release.
For ProjectTo, you need to inspect IQueryable.Expression.
var expression = context.Entities.ProjectTo<Dto>().Expression;