Esempio n. 1
0
        public static void Seed(StuDBContext context)
        {
            for (var i = 0; i < 1000; i++)
            {
                var fname    = "";
                var lname    = "";
                var d1       = context.DepartMent.SingleOrDefault(x => x.Name == "电子信息工程学院");
                var fullname = StudentSeed._GetRandomChineFullName(ref fname, ref lname);

                Random sj  = new Random();
                var    rnd = sj.Next(0, 1);
                var    s1  = new Student()
                {
                    StudentNo = "DZXX" + i.ToString("0000"),
                    FirstName = fname,
                    LastName  = lname,
                    FullName  = fullname,
                    BirhDay   = DateTime.Now,
                    Address   = "社弯路28号",
                    Sex       = rnd == 1? true : false,
                    phone     = "188**********"
                };
                context.Studetnt.Add(s1);
                Thread.Sleep(1);
                context.SaveChanges();
                _GarbageClear();
            }
        }
Esempio n. 2
0
 protected override void Seed(CodeFirt1108.DataContext.StuDBContext context)
 {
     Migratioms.Seed(context);
     StudentSeed.Seed(context);
 }