static void Main(string[] args) { string connectionString = "metadata=res://*/ClassAdministrationDatabase.csdl|res://*/ClassAdministrationDatabase.ssdl|res://*/" + "ClassAdministrationDatabase.msl;provider=System.Data.SqlClient;provider connection string=\"Data Source=SZARNYASG-PC\\SQLEXPRESS;Initial Catalog=ClassAdministration;Integrated Security=True\""; EntityConnection ec = new EntityConnection(); ec.ConnectionString = connectionString; using (ClassAdministrationEntityContext context = new ClassAdministrationEntityContext(ec)) { Group group1 = new Group(); Room room1 = context.RoomSet.First(); Instructor instructor1 = context.InstructorSet.First(); Course course1 = context.CourseSet.First(); Semester semester = context.SemesterSet.First(); context.GroupSet.AddObject(group1); context.SaveChanges(); } }
private Group newGroup(ref List<Room>.Enumerator roomEnumerator, ref List<Instructor>.Enumerator instructorEnumerator, Course course) { Group group = new Group(); groupIndex++; group.Index = groupIndex; group.Course = course; group.Semester = SelectedSemester; if (!roomEnumerator.MoveNext()) { throw new BUTEClassAdministrationException("Nincs elég terem a beosztáshoz"); } group.Room = roomEnumerator.Current; if (!instructorEnumerator.MoveNext()) { throw new BUTEClassAdministrationException("Nincs elég gyakorlatvezető a beosztáshoz"); } group.Instructor = instructorEnumerator.Current; return group; }
protected virtual void ClearNavigationProperties() { Course.Clear(); Group.Clear(); }