public IEnumerable<NotificationDto> GetNewNotifications()
{
var userId = User.Identity.GetUserId();
var notifications = _context.UserNotifications
.Where(un => un.UserId == userId)
.Select(un => un.Notification)
.Include(n => n.Gig.Artist)
.ToList();
Mapper.CreateMap<ApplicationUser, UserDto>();
Mapper.CreateMap<Gig, GigDto>();
Mapper.CreateMap<Notification, NotificationDto>();
return notifications.Select(Mapper.Map<Notification, NotificationDto>);
}
能否请你帮我确定正确此CreateMap,并解释为什么它定义这种方式后,显示此消息?为什么找不到这个方法?映射器不包含定义CreateMap
请参阅本又坏了同样的错误AutoMapper https://github.com/AutoMapper/AutoMapper/wiki/5.0-Upgrade-Guide – Ben