√ DO initialize AutoMapper once with Mapper.Initialize at AppDomain startup in legacy ASP.NET

√ DO use the AutoMapper.Extensions.Microsoft.DependencyInjection package in ASP.NET Core with services.AddAutoMapper(assembly[])

X DO NOT call CreateMap on each request

X DO NOT use inline maps

√ DO organize configuration into profiles

√ CONSIDER organizing profile classes close to the destination types they configure

X DO NOT access the static Mapper class inside a profile

X DO NOT use a DI container to register all profiles

X DO NOT inject dependencies into profiles

√ CONSIDER using configuration options supported by LINQ over options not supported by LINQ

X AVOID before/after map configuration

X AVOID ReverseMap in cases except when mapping only top-level, non-flattened properties

X DO NOT put any logic that is not strictly mapping behavior into configuration

X DO NOT use MapFrom when the destination member can already be auto-mapped

X DO NOT use AutoMapper except in cases where the destination type is a flattened subset of properties of the source type

X DO NOT use AutoMapper to support a complex layered architecture

X AVOID using AutoMapper when you have a significant percentage of custom configuration in the form of Ignore or MapFrom


√ DO flatten DTOs

X AVOID sharing DTOs across multiple maps

√ DO create inner types in DTOs for member types that cannot be flattened

X DO NOT create DTOs with circular associations

X AVOID changing DTO member names to control serialization

√ DO put common simple computed properties into the source model

√ DO put computed properties specific to a destination model into the destination model


√ CONSIDER using query projection (ProjectTo) over in-memory mapping

X DO NOT abstract or encapsulate mapping behind an interface

√ DO use mapping options for runtime-resolved values in projections

√ DO use mapping options for resolving contextualized services in in-memory mapping

X DO NOT complain about AutoMapper if you are not following the usage guidelines