예제 #1
0
        public static void Seed(ConsultantContext context)
        {
            context.Database.EnsureCreated();

            if (context.consultants.Any())
            {
                return;   // DB has been seeded
            }
            List <Competence> newCompetences = CreateFakeToDatabaseCompetences();

            context.competences.AddRange(newCompetences);
            context.SaveChanges();

            List <Consultant> newConsultants = CreateFakeToDatabaseConsultants();

            context.consultants.AddRange(newConsultants);
            context.SaveChanges();

            List <ConsultantCompetence> newCompetenceConsultants = CreateFakeToDatabaseCompetenceConsultant(newCompetences, newConsultants);

            context.ConsultantCompetences.AddRange(newCompetenceConsultants);
            context.SaveChanges();
        }
예제 #2
0
 public ConsultantRepository(ConsultantContext context)
 {
     this.context = context;
 }