From 2000bccaff2351a730255b28749f5061d27fc586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B8=BF=E9=9B=AF?= <3202800051@qq.com> Date: Sun, 5 Jan 2025 20:25:18 +0800 Subject: [PATCH] 0105 --- ...247\215\345\255\220\346\225\260\346\215\256.md" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "\350\214\203\351\270\277\351\233\257/20250103-\347\247\215\345\255\220\346\225\260\346\215\256.md" diff --git "a/\350\214\203\351\270\277\351\233\257/20250103-\347\247\215\345\255\220\346\225\260\346\215\256.md" "b/\350\214\203\351\270\277\351\233\257/20250103-\347\247\215\345\255\220\346\225\260\346\215\256.md" new file mode 100644 index 0000000..53bb48b --- /dev/null +++ "b/\350\214\203\351\270\277\351\233\257/20250103-\347\247\215\345\255\220\346\225\260\346\215\256.md" @@ -0,0 +1,14 @@ +## 种子数据 +```c# +public class AppDbContext : DbContext{ +public AppDbContext(DbContextOptions options) :base(options){} +protected override void OnModelCreating(ModelBuilder modelBuilder){ + modelBuilder.Entity().HasData( + new Idol{Id=1,Name="JinMin"}, + new Idol{Id=2,Name="JiSung"} + ) +} +} + + +``` \ No newline at end of file -- Gitee