示例#1
0
        static void Main()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<SchoolSystemContext, Configuration>());

            var db = new SchoolSystemContext();

            var newStudent = new Student { Name = "Random Person", Number = "99999", };
            db.Students.Add(newStudent);

            db.SaveChanges();
        }
示例#2
0
        static void Main(string[] args)
        {
            SchoolSystemContext context = new SchoolSystemContext();

            Student sampleStudent = new Student();

            sampleStudent.Name = "Name2";

            context.Students.Add(sampleStudent);

            context.SaveChanges();
        }