未映射的属性:_entityWrapper

问题描述 投票:0回答:1

找到了未映射的成员。查看下面的类型和成员。添加自定义映射表达式,忽略,添加自定义解析程序或修改源/目标类型

For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

AutoMapper为您创建了此类型映射,但无法使用当前配置映射您的类型。 CustomerDto - > Customer_F18BD0407D7AB3084DFC14364CBC838E797CB114E45768DA5EB22B4A1CC94C26(目的地成员列表)WebApiCollection.DTO.CustomerDto - > System.Data.Entity.DynamicProxies.Customer_F18BD0407D7AB3084DFC14364CBC838E797CB114E45768DA5EB22B4A1CC94C26(目的地成员列表)

未映射的属性:_entityWrapper

var customerInDb = _dbContext.Customers.SingleOrDefault(p => p.Id == customerDto.Id); if(customerInDb == null)返回NotFound();

            customerInDb = Mapper.Map(customerDto, customerInDb);
entity-framework-6 asp.net-web-api2 dbcontext automapper-8
1个回答
0
投票

你有没有尝试过?

customerInDb = Mapper.Map<Customer>(customerDto);
© www.soinside.com 2019 - 2024. All rights reserved.