如何配置AutoMapper以映射实体

时间:2017-09-03 21:40:58

标签: c# automapper automapping

这是老师

public class Teacher

{
    public int Id { get; set; }

    public string Education { get; set; }

    public string Expereince { get; set; }

    public List<Courses> Courses { get; set; }

    public int UserId { get; set; }

    public User Users { get; set; }
}

我还有两个实体,我需要映射到DTO

public class AllCourseDto
{
    public string Name { get; set; }

    public string TeacherName { get; set; }

    public string DateStart { get; set; }

    public string DateEnd { get; set;}
}

我想将Teacher映射到AllCoursesDTO,你能解释一下,我如何调整我的Mapper,当前映射到AllCourseDTO

0 个答案:

没有答案