static void Main(string[] args) { using (var db = new StudentContext()) { var student = new Student() {Name = "Fabio Scapel"}; var mathSubject = new Subject() {Name = "math"}; var scienceSubj = new Subject() {Name = "Data Structures"}; student.Subjects.Add(mathSubject); student.Subjects.Add(scienceSubj); db.Students.Add(student); db.SaveChanges(); } }