var objInterview = ServiceManager.InterviewServiceInstance.GetInterview(InterviewID);
Mapper.Initialize(cfg =>
{
cfg.CreateMap<Interview, InterviewViewModel>()
.ForMember(dest => dest.CityName, opt => opt.MapFrom(src => src.Cities.CityName))
.ForMember(dest => dest.DesignationName, opt => opt.MapFrom(src => src.Designations.DesignationName));
});
InterviewViewModel vmInterview = new InterviewViewModel();
vmInterview = Mapper.Map<Interview, InterviewViewModel>(objInterview);
return View("Interview", vmInterview);
objInterview具有CityID和DesignationID的值。但是在映射之后,我希望在vmInterview中获得CityName和DesignationName。我为他们取消了。我错过了什么吗?