Back to Automapper

15.0 Upgrade Guide

docs/source/15.0-Upgrade-Guide.md

16.1.11.1 KB
Original Source

15.0 Upgrade Guide

Release notes.

AutoMapper now targets .NET 8, 9 and .NET Standard 2.0

AutoMapper now requires a license

You can set your license via the configuration:

c#
services.AddAutoMapper(cfg => {
    cfg.LicenseKey = "<License Key Here>";
});

You can register for your license at https://automapper.io.

Breaking Changes

AddAutoMapper

With the requirement to supply a license, the AddAutoMapper overloads all require the Action<IMapperConfigurationExpression> parameter:

c#
// Previous
services.AddAutoMapper(typeof(Program));

// Current
services.AddAutoMapper(cfg => cfg.LicenseKey = "<License Key Here>", typeof(Program));

This method parameter is first for all AddAutoMapper overloads.

MapperConfiguration

The constructor to MapperConfiguration now requires an ILoggerFactory:

c#
public MapperConfiguration(
    MapperConfigurationExpression configurationExpression, 
    ILoggerFactory loggerFactory)

This parameter is used for diagnostics.