AutoMapper错误 - 缺少类型映射配置或不支持的映射

时间:2013-10-29 01:23:31

标签: automapper

型号:

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()没有发现任何错误。

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

由于

0 个答案:

没有答案