现在学习EF Code-First多对多的配置。这里我们举例:学生和班级实体,一个学生可以选修多个课程,多个学生也可以选修同一个课程。一、使用数据注解特性,配置多对多的关系using System;using System.Collections.Generic;using Sy ...
现在学习EF Code-First多对多的配置。
这里我们举例:学生和班级实体,一个学生可以选修多个课程,多个学生也可以选修同一个课程。
一、使用数据注解特性,配置多对多的关系
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace EF7{ public class Student { public int StudentId { get; set; } public string StudentName { get; set; } public virtual ICollection<Course> Courses { get; set; } }}
原标题:Configure Many
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。