Using Profiles in Automapper to map the same types with different logic

后端 未结 1 778
谎友^
谎友^ 2020-11-29 03:24

I am using AutoMapper in my ASP.NET MVC website to map my database objects to ViewModel objects and I am trying to use several profiles to map the same types, but using anot

相关标签:
1条回答
  • 2020-11-29 03:59

    Profiles are for segregating common configuration applied across several type maps, like formatting. However, type maps are still global. You're better off creating separate Configuration objects, and creating a separate MappingEngine for each. The Mapper class is merely a static facade over each of those, with some lifecycle management.

    0 讨论(0)
提交回复
热议问题