-1
제 개인용 유형 : PagedList<T>
, 페이징을 담당합니다. 저장소에서 쿼리를 가져와 예를 들어 PagedList<User>
을 서비스하고 내 서비스가 PagedList<UserDTO>
을 반환해야합니다. return _mapper.Map <PagedList<User>, PagedList<UserDTO>>(userList);
를이 내가 무엇을 얻을 : 그래서 매핑 할Automapper ASP.NET CORE 매핑 사용자 지정 제네릭 형식 오류
ArgumentException:
App.Core.Paging.PagedList`1[App.Infrastructure.DTO.UserDTO] needs to have a
constructor with 0 args or only optional args.
Parameter name: type
lambda_method(Closure , PagedList<User> , PagedList<UserDTO> ,
ResolutionContext)
AutoMapperMappingException: Error mapping types.
그리고 내 매퍼 설정에
: cfg.CreateMap<User, UserDTO>();
이 충분히 아니면 나는 내가 모르는 뭔가가? 두 클래스의 속성은 동일합니다.
오류가 발생하면 'UserDTO'에 사용 가능한 생성자가 있습니까? – DavidG
사실, 나는'PagedList'를 말 했어야했는데 ... – DavidG
@DavidG 오 Paguild에서 빈 생성자를 만들고 User/UserDTO에서 검색하고 있었다. 감사! –
imaco