C# 自动映射异常开始突然显示

C# 自动映射异常开始突然显示,c#,exception,mapping,automapper,class-library,C#,Exception,Mapping,Automapper,Class Library,我有一个类库,在其中一个类中我使用Automapper。在constructor中,我是这样做的: Mapper.Initialize(cfg => { cfg.CreateMap<ItemSummary, Sponsor>(); cfg.CreateMap<AdminService.SponsorshipType, SponsorshipType>(); }); var sponso

我有一个类库,在其中一个类中我使用Automapper。在constructor中,我是这样做的:

Mapper.Initialize(cfg =>
        {
            cfg.CreateMap<ItemSummary, Sponsor>();
            cfg.CreateMap<AdminService.SponsorshipType, SponsorshipType>();
        });
var sponsors = _service.GetItems(_accessKey);
List<Sponsor> sponsorsList = new List<Sponsor>();
sponsorsList = Mapper.Map<List<Sponsor>>(sponsors);
return sponsorsList;

什么事情会突然出问题?这门课在其他地方没有任何变化,所以没有,这门课的任何地方都没有可能打破它。

没关系。有人在域模型中引入了参数化构造函数,AutoMapper似乎一点也不喜欢它。

没关系。有人在域模型中引入了一个参数化构造函数,AutoMapper似乎一点都不喜欢。

消息很简单,
POAItemSummary->SHANTOR
没有映射,您有
ItemSummary->SHANTOR
的映射,看起来服务正在返回
POA
类。否。实际上,POA前缀是一个拼写错误。因此,该对象实际上称为ItemSummary。我已经编辑了异常消息,因此现在它与实际的异常消息相对应,即没有输入错误。该消息是简单的,
POAItemSummary->substander
没有映射,您有
itemssummary->substander
的映射,看起来服务正在返回
POA
class.no。实际上,POA前缀是一个拼写错误。因此,该对象实际上称为ItemSummary。我已经编辑了异常消息,因此现在它与实际消息相对应,即没有输入错误
[AutoMapperMappingException: Missing type map configuration or unsupported mapping.
Mapping types:
ItemSummary -> Sponsor
Admin.Service.PlanOfficeAdminService.ItemSummary ->
Admin.Core.Models.Sponsors.Sponsor]
lambda_method(Closure , ItemSummary , Sponsor , ResolutionContext ) +73
AutoMapper.ResolutionContext.Map(TSource source, TDestination destination) +206
lambda_method(Closure , Object , Object , ResolutionContext ) +194

[AutoMapperMappingException: Error mapping types.

Mapping types:
ItemSummary[] -> List`1
Admin.Service.AdminService.ItemSummary[] -> 
System.Collections.Generic.List`1[[Admin.Core.Models.Sponsor, Admin.Core ...