1
public class fooViewModel{
public int id {get; set;}
public string companyname {get; set;}
public string companyaddress {get; set;}
public EmployeeViewModel CotactPerson {get; set;}
public EmployeeViewModel Manager {get; set;}
}
public class EmployeeViewModel {
public int id {get; set;}
public string employeename {get; set;}
public string mobile {get; set;}
}
public class Boo {
public int id {get; set;}
public string name{get; set;}
public string address {get; set;}
public Icollection<Employee> Employee {get; set;}
}
public class Employee
{
public int id {get; set;}
public int fooid {get; set;}
public foo foo {get; set;}
public int Booid {get; set;}
public string employeename {get; set;}
public string mobile {get; set;}
public datetime DateOfBirth {get; set;}
public string PlaceOfBirth{get; set;}
}
public class foo {
public int id {get; set;}
public string companyname {get; set;}
public string companyaddress {get; set;}
public string Email{get; set;}
public DateTime EstablismentDate{get; set;}
}
我要地圖我fooViewModel具有子對象使用automapper反之亦然從噓模型FooViewModel噓型號之間。請幫助我如何實現這種情況。如果有任何其他簡單的方法將Viewmodel映射到Domain Model和Domain Model到ViewModel,請對其進行解釋。如何使用automapper映射父子關係船模和視圖模型