protected override void Seed(BloggingDbContext dbContext) { //每次运行Update-Database,都会运行这个函数 BloggingDatabaseSeed.Seed(dbContext); }
/// <summary> /// A method that should be overridden to actually add data to the context for seeding. /// The default implementation does nothing. /// </summary> /// <param name="context">The context to seed. </param> protected override void Seed(BloggingDbContext context) { base.Seed(context); BloggingDatabaseSeed.Seed(context); }