From dc302a23b69cb5e933105b608980b32b9b7cd1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BF=8A=E6=9D=B0?= <2308285470@qq.com> Date: Sun, 5 Jan 2025 21:49:42 +0800 Subject: [PATCH] 0 --- "\345\274\240\344\277\212\346\235\260/20250105.md" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "\345\274\240\344\277\212\346\235\260/20250105.md" diff --git "a/\345\274\240\344\277\212\346\235\260/20250105.md" "b/\345\274\240\344\277\212\346\235\260/20250105.md" new file mode 100644 index 0000000..663a9bd --- /dev/null +++ "b/\345\274\240\344\277\212\346\235\260/20250105.md" @@ -0,0 +1,13 @@ +## 种子数据 +```html +public class AppDbContext : DbContext{ +public AppDbContext(DbContextOptions options) :base(options){} +protected override void OnModelCreating(ModelBuilder modelBuilder){ + modelBuilder.Entity().HasData( + new Idol{Id=1,Name="bk"}, + new Idol{Id=2,Name="pp"} + ) +} +} + +``` \ No newline at end of file -- Gitee