diff --git "a/\351\203\221\347\242\247\344\273\231/2024-12-30\346\210\220\347\273\251\344\270\213\346\213\211\351\200\211\351\241\271.md" "b/\351\203\221\347\242\247\344\273\231/2024-12-30\346\210\220\347\273\251\344\270\213\346\213\211\351\200\211\351\241\271.md" new file mode 100644 index 0000000000000000000000000000000000000000..f54e4a416b4de7997dc531f7188d939d76edfce1 --- /dev/null +++ "b/\351\203\221\347\242\247\344\273\231/2024-12-30\346\210\220\347\273\251\344\270\213\346\213\211\351\200\211\351\241\271.md" @@ -0,0 +1,41 @@ +## 视图 + @model ScoreManger.Models.Score; +
+ +## 控制器 + //添加 + public IActionResult Create(){ + ViewBag.Score=_db.Score.ToList(); + ViewBag.Student=_db.Student.ToList(); + return View(); + } \ No newline at end of file diff --git "a/\351\203\221\347\242\247\344\273\231/2025-01-03\346\233\264\346\215\242\346\225\260\346\215\256\345\272\223(postgresql).md" "b/\351\203\221\347\242\247\344\273\231/2025-01-03\346\233\264\346\215\242\346\225\260\346\215\256\345\272\223(postgresql).md" new file mode 100644 index 0000000000000000000000000000000000000000..2736ed70fc90250d1241968a2178a92552801db5 --- /dev/null +++ "b/\351\203\221\347\242\247\344\273\231/2025-01-03\346\233\264\346\215\242\346\225\260\346\215\256\345\272\223(postgresql).md" @@ -0,0 +1,12 @@ +## 更换数据库 + 1. 安装好postgresql数据库 + - 在Debian上安postgresql数据库 + - 确认是否安装成功 + - 设置高强度密码 + - 设置允许远程访问数据库 + 2. 更换数据库驱动(配合OPM工具),并且·重新生成迁移文件 + - 移除原来的数据库驱动:dotnet remove package Microsoft.EntityFrameworkCore.SqlServer + - 安装新的数据库驱动:dotnet add package Npgsqld.EntityFrameworkCore.Postgresql + - 更换数据库上下文配置 + - 重新生成迁移文件 + - 同步迁移文件