【发布时间】:2022-11-29 14:34:15
【问题描述】:
我一直在寻找我编写的代码的答案,但我找不到任何解决方案以及它给我这个错误的原因。
我正在尝试将我的 Object1 映射到 Object2,但出现此错误,不确定我在代码中遗漏了什么。
Object1 obj1 = this._mapper.Map<Object1>(new Object2());
我也尝试过这种不同的方法,但仍然出错
//var obj1 = _mapper.Map<Object1>(request.Object2);
错误:
type": "https://httpstatuses.com/500",
"title": "Internal Server Error",
"status": 500,
"detail": "Missing type map configuration or unsupported mapping.\r\n\r\nMapping types:\r\nObject -> Object1 ...... -> ......",
【问题讨论】:
-
Did you configure the objects to be mapped? 另外,您的错误是“对象 -> 对象 1”,但您的代码显示对象 1 和对象 2,您发布的代码是返回您发布的错误的代码吗?