AutoMapper's Design Philosophy

While a lot of people use AutoMapper, and love it, I meet just as many people that hate it. When I hear their stories, it becomes clear to me that it's not that AutoMapper was "abused" per se, but that it was used without understanding why AutoMapper exists and what problems it was designed to solve. AutoMapper originated at the beginning of a large MVC application way back in the [Read More]

AutoMapper Usage Guidelines

Configuration √ DO initialize AutoMapper once with Mapper.Initialize at AppDomain startup in legacy ASP.NET AutoMapper's static initialization is designed to build configuration once, and cache it. √ DO use the AutoMapper.Extensions.Microsoft.DependencyInjection package in ASP.NET Core with services.AddAutoMapper(assembly[]) The extensions package will perform all the scanning and dependency injection registration. You only need to declare Profile configuration. X DO NOT call CreateMap on each request [Read More]

AutoMapper 8.0.0 Released

Today we released AutoMapper 8.0.0: Upgrade Guide Release Notes AutoMapper 8.0 brings some breaking API changes, meant to simplify our configuration options which have grown quite a bit over time and remove some confusion about what configuration options were effectively equivalent. The upgrade guide walks through the breaking changes. The motivation for breaking the API also came from some confusion around mapping configuration used for in-memory mappings [Read More]

Contoso University Examples with CQRS, MediatR, AutoMapper and more

I was a bit surprised yesterday to see Scott Hanselman's post on my Contoso University sample app. That application basically takes the traditional Contoso University sample applications (of which there have been many), and try to adapt it to how our "normal" ASP.NET applications are built. Mainly these applications serve as working examples for our own internal teams, so that when we spin up a new application, we have [Read More]

AutoMapper extensions for Microsoft DI 5.0 released

Hot off the presses, with some pretty big breaking changes. For the unfamiliar, the AutoMapper.Extensions.Microsoft.DependencyInjection package is the extension to the MS DI libraries used by ASP.NET Core and others. It lets you do: services.AddMvc(); services.AddAutoMapper(); And this package finds all AutoMapper configuration in the current AppDomain, or assemblies you specify, configure everything, and register the AutoMapper-specific services with the container. In the past, [Read More]