2

I'm using version 5.1.1.0 of AutoMapper. Previously I was able to the following:

Mapper.CreateMap<SchoolYearDetail, SchoolYearDto>();

But in the version 5.1.1.0 it doesn't exist anymore. Can anyone tell me what to do?

Bart Schelkens
  • 1,235
  • 4
  • 21
  • 45

1 Answers1

8

Previously AutoMapper was static as per your example, it now wants to be instantiated.

Link below is by the creator of AutoMapper
https://lostechies.com/jimmybogard/2016/01/21/removing-the-static-api-from-automapper/

Here is a snippet if that link stops working.

var config = new MapperConfiguration(cfg => {
  cfg.CreateMap<Source, Dest>();
});

var mapper = config.CreateMapper();
var source = new Source();
var dest = mapper.Map<Source, Dest>(source);

Plenty of other stackoverflow posts related to this:

Automapper says Mapper.Map is obsolete, global mappings?

AutoMapper Migrating from static API

Hope that helps.

Community
  • 1
  • 1
NPhillips
  • 505
  • 4
  • 19