已經配置了map,并已依賴注入cfg.CreateMap<User, MentionUserDto>();使用 _mapper.Map<IEnumerable<MentionUserDto>>() 正常,但使用 .ProjectTo<MentionUserDto>(_mapper) 總是提示下面的錯誤:Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.
at AutoMapper.Mapper.get_Configuration()
- 1 回答
- 0 關注
- 972 瀏覽
添加回答
舉報
0/150
提交
取消