1

我想知道为什么我们会收到这个错误,以及如何在不为各个类创建单独映射的情况下解决它。

我有两个要自动映射的类。我对其他两个类采用了相同的方法,它被完美地映射,但对于这些类,它没有被映射并抛出错误。

public class DecisionRequestResponse
{
    public string ReqId { get; set; }
    public string Decision { get; set; } 
    public string ReasonId { get; set; }
    public string NotUsedInDecision { get; set; }
    public string SrcEQ { get; set; } 
    public string SrcTU { get; set; } 
    public string SrcBancoInternal { get; set; } 
    public string SrcExternal { get; set; } 
    public string ReasonCodeId { get; set; }
}

public class DecisionRequestResponseObj
{
    public REQUEST Request { get; set; }
    public REQUESTEXT RequestExt { get; set; }
    public REQDECISIONREASON ReqDecisionReason { get; set; }
}

CreateMap<DecisionRequestResponse, DecisionRequestResponseObj>()
.ForMember(dest => dest.Request.ID, opt => opt.MapFrom(src => src.ReqId))
.ForMember(dest => dest.Request.PROPOSEDAMTTOTAL, opt => opt.MapFrom(src => src.EvaluatedAmt))
.ForMember(dest => dest.RequestExt.ID, opt => opt.MapFrom(src => src.ReqId))
.ForMember(dest => dest.RequestExt.TEMPDECISIONSTATUSCD, opt => opt.MapFrom(src => src.Decision))
.ForMember(dest => dest.ReqDecisionReason.ID, opt => opt.MapFrom(src => src.ReasonId))
.ForMember(dest => dest.ReqDecisionReason.REQID, opt => opt.MapFrom(src => src.ReqId))
.ForMember(dest => dest.ReqDecisionReason.NOTUSEDINDECFLG, opt => opt.MapFrom(src => src.NotUsedInDecision));
4

0 回答 0