AutoMapper Migrating from static API

后端 未结 4 1650
无人及你
无人及你 2020-12-05 05:08

https://github.com/AutoMapper/AutoMapper/wiki/Migrating-from-static-API

this change breaks my system.

Before update, I use:

===> Startup.cs



        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 05:18

    Instead of:

    Mapper.CreateMap();
    

    The new syntax is:

    var config = new MapperConfiguration(cfg => {
      cfg.CreateMap();
    });
    

    Then:

    IMapper mapper = config.CreateMapper();
    var source = new AbcEditViewModel();
    var dest = mapper.Map(source);
    

    (Source with more examples)

提交回复
热议问题