更新时间:2021-09-10 03:31:49
您需要将MappingConfiguration提供程序传递给ProjectTo调用.
You need to pass the MappingConfiguration provider to the ProjectTo call.
public async Task<FreelancerProfileViewModel> GetFreelancerProfile()
{
var id = Guid.Parse(_identity.GetUserId());
var model = await _freelancerProfiles
.AsNoTracking()
.Where(_ => _.User.Id == id)
.ProjectTo<FreelancerProfileViewModel>(_mapper.Configuration)
.FirstAsync();
// var viewmodel = _mapper.Map<FreelancerProfileViewModel>(model);
return model;
}