示例#1
0
 public CourseRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#2
0
 public EnrollmentRepository(ContosoContext context) : base(context)
 {
 }
示例#3
0
 public InstructorRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#4
0
        public static void Initialize(ContosoContext context)
        {
            if (context.Students.Any())
            {
                return;
            }

            var students = new Student[]
            {
                new Student
                {
                    FirstMidName = "Carson", LastName = "Alexander", EnrollmentDate = DateTime.Parse("2005-09-01")
                },
                new Student
                {
                    FirstMidName = "Meredith", LastName = "Alonso", EnrollmentDate = DateTime.Parse("2002-09-01")
                },
                new Student
                {
                    FirstMidName = "Arturo", LastName = "Anand", EnrollmentDate = DateTime.Parse("2003-09-01")
                },
                new Student
                {
                    FirstMidName = "Gytis", LastName = "Barzdukas", EnrollmentDate = DateTime.Parse("2002-09-01")
                },
                new Student {
                    FirstMidName = "Yan", LastName = "Li", EnrollmentDate = DateTime.Parse("2002-09-01")
                },
                new Student
                {
                    FirstMidName = "Peggy", LastName = "Justice", EnrollmentDate = DateTime.Parse("2001-09-01")
                },
                new Student
                {
                    FirstMidName = "Laura", LastName = "Norman", EnrollmentDate = DateTime.Parse("2003-09-01")
                },
                new Student
                {
                    FirstMidName = "Nino", LastName = "Olivetto", EnrollmentDate = DateTime.Parse("2005-09-01")
                }
            };

            foreach (Student s in students)
            {
                context.Students.Add(s);
            }

            context.SaveChanges();

            var courses = new Course[]
            {
                new Course {
                    Id = 1050, Title = "Chemistry", Credits = 3
                },
                new Course {
                    Id = 4022, Title = "Microeconomics", Credits = 3
                },
                new Course {
                    Id = 4041, Title = "Macroeconomics", Credits = 3
                },
                new Course {
                    Id = 1045, Title = "Calculus", Credits = 4
                },
                new Course {
                    Id = 3141, Title = "Trigonometry", Credits = 4
                },
                new Course {
                    Id = 2021, Title = "Composition", Credits = 3
                },
                new Course {
                    Id = 2042, Title = "Literature", Credits = 4
                }
            };

            foreach (Course c in courses)
            {
                context.Courses.Add(c);
            }

            context.SaveChanges();

            var enrollments = new Enrollment[]
            {
                new Enrollment {
                    StudentId = 1, CourseId = 1050, Grade = Grade.A
                },
                new Enrollment {
                    StudentId = 1, CourseId = 4022, Grade = Grade.C
                },
                new Enrollment {
                    StudentId = 1, CourseId = 4041, Grade = Grade.B
                },
                new Enrollment {
                    StudentId = 2, CourseId = 1045, Grade = Grade.B
                },
                new Enrollment {
                    StudentId = 2, CourseId = 3141, Grade = Grade.F
                },
                new Enrollment {
                    StudentId = 2, CourseId = 2021, Grade = Grade.F
                },
                new Enrollment {
                    StudentId = 3, CourseId = 1050
                },
                new Enrollment {
                    StudentId = 4, CourseId = 1050
                },
                new Enrollment {
                    StudentId = 4, CourseId = 4022, Grade = Grade.F
                },
                new Enrollment {
                    StudentId = 5, CourseId = 4041, Grade = Grade.C
                },
                new Enrollment {
                    StudentId = 6, CourseId = 1045
                },
                new Enrollment {
                    StudentId = 7, CourseId = 3141, Grade = Grade.A
                },
            };

            foreach (Enrollment e in enrollments)
            {
                context.Enrollments.Add(e);
            }

            context.SaveChanges();
        }
示例#5
0
 public RoleRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#6
0
 public PersonRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#7
0
 public DepartmentRepository(ContosoContext context) : base(context)
 {
 }
 public DepartmentRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#9
0
 public InstructorRepository(ContosoContext context) : base(context)
 {
 }
示例#10
0
 public Repository(ContosoContext context)
 {
     _context = context;
     dbSet    = context.Set <T>();
 }
示例#11
0
 public StudentRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#12
0
 public PeopleRepository(ContosoContext context) : base(context)
 {
 }
示例#13
0
 public EnrollmentRepository(ContosoContext context)
 {
     this.context = context;
 }
示例#14
0
 public CourseRepository(ContosoContext context) : base(context)
 {
 }
 public OfficeAssignmentRepository(ContosoContext context)
 {
     this.context = context;
 }