我的DTO类包含另一个子类,
Class ABC_DTO
{
public String XYZ {get;set;}
public BCD_DTO BCD {get;set;}
}
Class BCD_DTO
{
public string Name {get;set;}
public string Age {get;set;}
}
//This is Viewmodel
class PQR_ViewModel
{
public string Name {get;set;}
public string Age {get;set;}
public String XYZ {get;set;}
}
How can i map above Dto ABC_DTO into PQR_ViewModel using ValueInjecter?
答案 0 :(得分:1)
var viewModel = new PQR_ViewModel();
viewModel.InjectFrom(abc);
viewModel.InjectFrom(abc.BCD);