コード例 #1
0
        public static async Task InsertTestData(SkillustratorContext db)
        {
            var person = new Person {
                Id        = 999,
                LastName  = "Tester",
                FirstName = "Mister"
            };

            db.People.Add(person);

            var skills = new List <Skill>();

            skills.Add(new Skill {
                Name = "CSS"
            });
            skills.Add(new Skill {
                Name = "Javascript"
            });
            skills.Add(new Skill {
                Name = "C#"
            });
            skills.Add(new Skill {
                Name = ".NET Core"
            });
            skills.Add(new Skill {
                Name = "Angular"
            });
            skills.Add(new Skill {
                Name = "React"
            });
            skills.Add(new Skill {
                Name = "jQuery"
            });
            skills.Add(new Skill {
                Name = "Python"
            });
            skills.Add(new Skill {
                Name = "Django"
            });
            skills.Add(new Skill {
                Name = "Flask"
            });
            skills.Add(new Skill {
                Name = "Ruby"
            });
            skills.Add(new Skill {
                Name = "Rails"
            });

            db.Skills.AddRange(skills);

            await db.SaveChangesAsync();
        }
コード例 #2
0
 public virtual Task <int> SaveChangesAsync()
 {
     return(_context.SaveChangesAsync());
 }