0

楷模:

public class CredentialAPIModel
{
    public string UserName { get; set; }

    public string Password { get; set; }
}

public class CredentialEntity
{
    public string UserName { get; set; }

    public string Password { get; set; }
}

我的映射:

Mapper.CreateMap<CredentialEntity, CredentialAPIModel>();
Mapper.CreateMap<CredentialAPIModel, CredentialEntity>();

这就是失败的地方:

public LoginAPIResponse Login(CredentialAPIModel credentials)
{
    CredentialEntity credentialEntity = Mapper.Map<CredentialAPIModel, CredentialEntity>(credentials);

    LoginResponse appSecurityResponse = BO.Login(credentialEntity);

    .
    .
    .       
}

我明白了:

Missing type map configuration or unsupported mapping.

Mapping types:
CredentialAPIModel -> CredentialEntity
FMG.WebServiceAPI.Models.AppSecurity.Models.CredentialAPIModel -> FMG.Entities.AppSecurity.Entities.CredentialEntity

Destination path:
CredentialEntity

Source value:
FMG.WebServiceAPI.Models.AppSecurity.Models.CredentialAPIModel

Mapper.AssertConfigurationIsValid() 没有发现任何错误。

有人看到这里有什么问题吗?

谢谢

4

0 回答 0