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