MVC3多对多,附加列示例

时间:2012-02-03 21:10:16

标签: asp.net-mvc

这是最好的方法,或者如果你看过一个最好的方法示例,或者一种方式向用户显示这个模型的视图,如果你有和链接的例子将是更好

public class Student
    {
        public int StudentID { get; set; }
        public string FirstMidName { get; set; }
        public virtual ICollection<Enrollment> Enrollments { get; set; }
    }


  public class Enrollment
    {
        public int EnrollmentID { get; set; }
        public int CourseID { get; set; }
        public int StudentID { get; set; }
        public decimal? Grade { get; set; }

        public virtual Course Course { get; set; }
        public virtual Student Student { get; set; }
    }


public class Course
    {

        public int CourseID { get; set; }
        public string Title { get; set; }
        public virtual ICollection<Enrollment> Enrollments { get; set; }
    }

0 个答案:

没有答案