Contoso University EF
2017-04-01 12:12:13 1 举报
实体模型,使用代码方便学习实体模型关系如何定义。 定义参考: https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/complex-data-model#create-the-officeassignment-entity
作者其他创作
大纲/内容
public class Instructor { public int ID { get; set; } [Required] [Display(Name = \"Last Name\")] [StringLength(50)] public string LastName { get; set; } [Required] [Column(\"FirstName\")] [Display(Name = \"First Name\")] [StringLength(50)] public string FirstMidName { get; set; } [DataType(DataType.Date)] [DisplayFormat(DataFormatString = \"{0:yyyy-MM-dd}\
public class Enrollment { public int EnrollmentID { get; set; } public int CourseID { get; set; } public int StudentID { get; set; } [DisplayFormat(NullDisplayText = \"No grade\
0..1 ~ *
public class Student { public int ID { get; set; } [Display(Name = \"姓\
public class OfficeAssignment { [Key] public int InstructorID { get; set; } [StringLength(50)] [Display(Name = \"Office Location\")] public string Location { get; set; } public Instructor Instructor { get; set; } }
0..1~1
public class Course { [DatabaseGenerated(DatabaseGeneratedOption.None)] [Display(Name = \"Number\
1 ~ *
public class CourseAssignment { public int InstructorID { get; set; } public int CourseID { get; set; } public Instructor Instructor { get; set; } public Course Course { get; set; } }
* ~ 1
0 条评论
下一页