AutoMapperConfigurationException:仅类型的顶级单个成员支持成员的自定义配置

时间:2019-02-21 09:56:55

标签: c# .net automapper

我收到此错误,但我不明白为什么。我正在尝试将Client对象映射到ClaimClient对象(如下所示):

x.CreateMap<Client, ClaimClient>();

如您所见,ClaimClient将包含所有客户端属性以及上面显示的其他属性。我的映射器:

x.CreateMap<Client, ClaimClient>()
                .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
                .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName))
                .ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Title))
                .ForPath(dest => dest.pAddress, opt => opt.MapFrom(src => src.pAddress))
                .ForMember(dest => dest.IsLead, opt => opt.MapFrom(src => src.IsLead))
                .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
                .ForMember(dest => dest.HasOptions, opt => opt.MapFrom(src => src.HasOptions))
                .ForPath(dest => dest.Options, opt => opt.MapFrom(src => src.Options));


                x.CreateMap<Client, Client>();

我唯一能想到的是期望我定义客户与客户之间的映射?任何帮助表示赞赏

编辑:

映射器现在如下,但仍然出现相同的错误:

 select id, CONCAT(first_name, ' ', last_name) 
 from a 
 where first_name is NOT null 
 and last_name is NOT null;

0 个答案:

没有答案