来自其他表的自动映射器ID

时间:2019-04-29 12:51:52

标签: c# entity-framework automapper

我有学生班:

@observable comparsionMap = new Map(); // the map that stores the sub stores


 neededStores.forEach(Store => {
   this.comparsionMap.set(
     Store.name,
     new Store(this.draftDto, this.handleUpdateCommonDto)
   );
 }); // the way i create my sub stores

 @computed get stuff() {
   console.log(this.comparsionMap)
   return this.comparsionMap.get("StoreB");
 } // my computed

和班级:

public class StudentsDTO
{
    public int Id { get; set; }
    public string FullName { get; set; }
    public int? FkGraduates { get; set; }
    public int FkClass { get; set; }
    public int? FkClassNavigationFkTeacher { get; set; }
}

我希望学生班上 public partial class Classes { public Classes() { Students = new HashSet<Students>(); } public int Id { get; set; } public string Title { get; set; } public int? FkTeacher { get; set; } public Teachers FkTeacherNavigation { get; set; } public ICollection<Students> Students { get; set; } } 班 为此,我使用自动映射器来映射值,这是我的方法:

FkTeacher

但是,这行不通,我得到 CreateMap<Classes, StudentsDTO>().ForMember(dto => dto.FkClassNavigationFkTeacher, opt => opt.MapFrom(x => x.FkTeacher)); 的{​​{1}}

我怎么了?

我没有得到的是,如果我在get方法中写了null

fkClassNavigationFkTeacher

它返回var classes = _classesService.GetAllClasses();有什么意义?

0 个答案:

没有答案