これは私のソースクラス
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; }
}
これが私のDestinationクラスです
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);
}
どうやってやるの??