//WEITERMACHEN Verbindungen!!! public void insertStudenLectureAssociations() { //erst die Studenten Holen Student carla = dataContext.Student.First(st => st.Name.Equals("Carla")); Student pedro = dataContext.Student.First(st => st.Name.Equals("Pedro")); Student xing = dataContext.Student.First(st => st.Name.Equals("Xing Mi Huang")); Student joseluisete = dataContext.Student.First(st => st.Name.Equals("Jose Luisete")); Student james = dataContext.Student.First(st => st.Name.Equals("James")); //gebraucht um die ganzen verbindungen zu haben!! //dann die Fächer Lecture mathe = dataContext.Lecture.First(Lecture => Lecture.Name.Equals("Mathematik")); Lecture geschichte = dataContext.Lecture.First(Lecture => Lecture.Name.Equals("Geschichte")); Lecture fisik = dataContext.Lecture.First(Lecture => Lecture.Name.Equals("Fisik")); //wir schreiben die studenten-Leture Verbindungen!! //LEHRER SCHNELLERE VERSION, anstatt die 3 Linie alles zusammen: dataContext.StudentLecture.InsertOnSubmit(new StudentLecture { Student = carla, Lecture = mathe }); dataContext.StudentLecture.InsertOnSubmit(new StudentLecture { Student = pedro, Lecture = mathe }); // Längere Version auch von Lehrer StudentLecture slXing = new StudentLecture(); slXing.StudentId = xing.Id; slXing.LectureId = geschichte.Id; dataContext.StudentLecture.InsertOnSubmit(slXing); dataContext.StudentLecture.InsertOnSubmit(new StudentLecture { Student = joseluisete, Lecture = fisik }); dataContext.StudentLecture.InsertOnSubmit(new StudentLecture { Student = joseluisete, Lecture = geschichte }); dataContext.StudentLecture.InsertOnSubmit(new StudentLecture { Student = joseluisete, Lecture = mathe }); dataContext.SubmitChanges(); //update the changes to the DB MainDataGrid.ItemsSource = dataContext.StudentLecture; // Student und Lecture werden auch fälschlich angezeigt da wir das ganze Objekt übergeben... das ist nicht so ganz ok }
private void detach_StudentLecture(StudentLecture entity) { this.SendPropertyChanging(); entity.Lecture = null; }
private void attach_StudentLecture(StudentLecture entity) { this.SendPropertyChanging(); entity.Lecture = this; }
partial void DeleteStudentLecture(StudentLecture instance);
partial void UpdateStudentLecture(StudentLecture instance);
partial void InsertStudentLecture(StudentLecture instance);