Several changes before queryDatabase project

This commit is contained in:
2019-11-13 22:22:46 +01:00
parent 9d861108d3
commit 1fc695559a
23 changed files with 1120 additions and 24 deletions

View File

@ -1,3 +1,5 @@
using System.Collections.ObjectModel;
namespace CodeFirstExistingDatabase.Migrations
{
using System;
@ -14,10 +16,17 @@ namespace CodeFirstExistingDatabase.Migrations
protected override void Seed(CodeFirstExistingDatabase.PlutoContext context)
{
// This method will be called after migrating to the latest version.
context.Authors.AddOrUpdate(a => a.Name,
new Author
{
Name = "Author 7",
Courses = new Collection<Course>()
{
new Course(){ Name = "Course for Author 7", Description = "Description 7"}
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data.
}
}
);
}
}
}