Entity Framework + AutoMapper ( Entity to DTO and DTO to Entity )

后端 未结 8 1247
逝去的感伤
逝去的感伤 2021-01-30 07:38

I\'ve got some problems using EF with AutoMapper. =/

for example :

I\'ve got 2 related entities ( Customers and Orders ) and they\'re DTO classes :

         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 08:18

    AutoMapper is very expressive when it comes to mapping error. read the exception message carefully.

    another important thing is to remember to call Mapper.AssertConfigurationIsValid(); after creating the mappings. it gives an error if the mapping is wrong, thus preventing an exception later in the application runtime.

提交回复
热议问题