blob: 95eb460b905e60144ba8c3fd2031fab1a7c3e8ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using Microsoft.EntityFrameworkCore;
using NodaTime;
namespace CoreWiki.Models;
public class ApplicationDbContext : DbContext
{
public DbSet<Article> Articles { get; set; }
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Article>().HasData(
new Article { Id = 1, Topic = "Home Page", Slug = "home-page", ViewCount = 0, Content = "Welcome to your new CoreWiki installation" }
);
}
}
|