我有3个类从实体框架获取数据:
public class State{
.......
public string Name{get; set;}
public IList<City> Cities{get;set;}
}
public class City{
.......
public string Name{get; set;}
public State State{get; set;}
}
public class Empleoyee{
......
public string Name{get; set;}
public City City{get; set;}
}
我正在创建一个像这样的员工汇总视图:
Employees
-------------------
CityStateName CityName Name
摘要类是这样的:
public class EmpleoyeeSummaryView{
public string Name{get; set;}
public string CityName{get; set;}
public string CityStateName{get; set;} ?????
}
我将Mapper.CreateMap<Employee, EmpleoyeeSummaryView>
和CityStateName
映射到empty/null
Employees
-------------------
CityStateName CityName Name
City1 Emp1
City2 Emp2
City1 Emp3