renaming
This commit is contained in:
24
5/Data/ApplicationDbInitializer.cs
Normal file
24
5/Data/ApplicationDbInitializer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Example.Models;
|
||||
|
||||
namespace Example.Data;
|
||||
|
||||
public static class ApplicationDbInitializer
|
||||
{
|
||||
public static void SeedDevelopmentData(ApplicationDbContext db)
|
||||
{
|
||||
if (db.Authors.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var authors = new[]
|
||||
{
|
||||
new Author("Author 1", "Author 1", new DateTime(1981, 1, 1)),
|
||||
new Author("Author 2", "Author 2", new DateTime(1982, 2, 2)),
|
||||
new Author("Author 3", "Author 3", new DateTime(1983, 3, 3))
|
||||
};
|
||||
|
||||
db.Authors.AddRange(authors);
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user