AutoMapper 8.1.0 Released

Today we released AutoMapper 8.1.0:

AutoMapper 8.1 adds a major new feature - attribute-based maps. Attribute maps let you easily declare maps on destination types when you have straightforward scenarios. Instead of:

public class OrderProfile {
    public OrderProfile() {
        CreateMap<Order, OrderIndexModel>();
        CreateMap<Order, OrderEditModel>();
        CreateMap<Order, OrderCreateModel>();
    }
}

You can declare your type maps directly on the destination types themselves with AutoMapAttribute:

[AutoMap(typeof(Order))]
public class OrderIndexModel {
    // members
}

[AutoMap(typeof(Order))]
public class OrderEditModel {
    // members
}

[AutoMap(typeof(Order))]
public class OrderCreateModel {
    // members
}

When you perform services.AddAutoMapper or cfg.AddMaps for any profile scanning, all attribute maps will get pulled in as well.

For most straightforward member configuration, we included attributes as well.

Enjoy!