这是我的源类
public class Content :IAggregateRoot
{
public Guid Id { get; set; }
public string HeaderImage { get; set; }
public string AboutText { get; set; }
public string Address { get; set; }
public long Phone { get; set; }
public long Mobile { get; set; }
public DateTime CreationTime { get; set; }
}
这是我的目的地课程
public class AboutViewModel
{
public string AboutText { get; set; }
public string Address { get; set; }
public long Phone { get; set; }
public long Mobile { get; set; }
}
我只想使用此方法使用 Automapper 忽略源的额外属性并将源映射到目标
public static AboutViewModel ConvertToAboutViewModel(this Content content)
{
// Mapper.CreateMap<Content,AboutViewModel>().ForMember(x=>x.AboutText,)
return Mapper.Map<Content, AboutViewModel>(content);
}
我怎样才能做到这一点??