C# 自动映射自定义解析程序不工作
我使用AutoMapper映射不同命名空间(即不同类库)中的类的对象。这两个类具有相同的结构。它们包含一些其他复杂类的成员。下面是我为映射编写的代码C# 自动映射自定义解析程序不工作,c#,asp.net,list,mapping,automapper,C#,Asp.net,List,Mapping,Automapper,我使用AutoMapper映射不同命名空间(即不同类库)中的类的对象。这两个类具有相同的结构。它们包含一些其他复杂类的成员。下面是我为映射编写的代码 //Structure of ActivePrticipant class public class ActiveParticipant { //Few properties with basic data types public List<CodedId> Roles { get{return _roles;}
//Structure of ActivePrticipant class
public class ActiveParticipant
{
//Few properties with basic data types
public List<CodedId> Roles
{
get{return _roles;}
set
{
if (value == null)
{
_roles = new List<CodedId>();
}
else
{
_roles = value;
}
}
}
}
此外,我无法调试自定义解析器代码。
如何映射这两个对象?您已经定义了以下对象之间的映射:
Mapper.CreateMap<ActiveParticipant, SomeOtherNameSpace.ActiveParticipant>();
Mapper.CreateMap();
您还需要:
Mapper.CreateMap<CodedId, SomeOtherNameSpace.CodedId>();
Mapper.CreateMap();
Missing type map configuration or unsupported mapping.
Mapping types:
CodedId -> CodedId
CodedId -> SomeOtherNameSpace.CodedId
Destination path:
IEnumerable`1[0][0]
Source value:
CodedId{ Property1:test, Property2:test2, Property3:Test3}
Mapper.CreateMap<ActiveParticipant, SomeOtherNameSpace.ActiveParticipant>();
Mapper.CreateMap<CodedId, SomeOtherNameSpace.CodedId>();