Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自动映射自定义解析程序不工作_C#_Asp.net_List_Mapping_Automapper - Fatal编程技术网

C# 自动映射自定义解析程序不工作

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;}

我使用AutoMapper映射不同命名空间(即不同类库)中的类的对象。这两个类具有相同的结构。它们包含一些其他复杂类的成员。下面是我为映射编写的代码

//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>();