+
+ Current Count: {{ counter.count }}
+
+```
\ No newline at end of file
--
Gitee
From eaaaa12c80e65986aa8934f9268ce120e4822b9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9A=E6=A2=A6=E7=94=B7?= <2609921471@qq.com>
Date: Sun, 23 Jun 2024 21:21:56 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=A7=9A=E6=A2=A6=E7=94=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20240617-\350\267\250\345\237\237.md" | 20 +++++++++++++++
...32\345\256\242\347\273\203\344\271\240.md" | 25 +++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 "\345\247\232\346\242\246\347\224\267/20240617-\350\267\250\345\237\237.md"
create mode 100644 "\345\247\232\346\242\246\347\224\267/20240619-\345\215\232\345\256\242\347\273\203\344\271\240.md"
diff --git "a/\345\247\232\346\242\246\347\224\267/20240617-\350\267\250\345\237\237.md" "b/\345\247\232\346\242\246\347\224\267/20240617-\350\267\250\345\237\237.md"
new file mode 100644
index 0000000..4522130
--- /dev/null
+++ "b/\345\247\232\346\242\246\347\224\267/20240617-\350\267\250\345\237\237.md"
@@ -0,0 +1,20 @@
+# 在ASP.NET Core应用程序中配置CORS(跨域资源共享)策略
+```
+public void ConfigureServices(IServiceCollection services)
+{
+ // 添加跨域服务
+ services.AddCors(options => {
+ // "AllowOrigin"是策略的名称,你可以根据需要命名它
+ options.AddPolicy("AllowOrigin",builder => {
+ builder.AllowAnyOrigin() //指定允许来自任何来源的请求,WithOrigins制定对某些域名开放
+ .AllowAnyMethod() //指定允许任何HTTP方法
+ .AllowAnyHeader(); //指定允许任何请求头
+ });
+ });
+}
+public void Configure(IApplicationBuilder app,IHostEnvironment env)
+{
+ // 使用 "AllowOrigin" 策略,要在启用路由中间件后使用
+ app.UseCors("AllowOrigin");
+}
+```
\ No newline at end of file
diff --git "a/\345\247\232\346\242\246\347\224\267/20240619-\345\215\232\345\256\242\347\273\203\344\271\240.md" "b/\345\247\232\346\242\246\347\224\267/20240619-\345\215\232\345\256\242\347\273\203\344\271\240.md"
new file mode 100644
index 0000000..3a43f61
--- /dev/null
+++ "b/\345\247\232\346\242\246\347\224\267/20240619-\345\215\232\345\256\242\347\273\203\344\271\240.md"
@@ -0,0 +1,25 @@
+# 博客表考前梳
+### 后端webapi
+1. 配置入口文件Program.cs
+2. 配置启动类,注册依赖Startup.cs
+3. 创建封装表格Domain/Blog.cs
+4. 创建表格数据实体类Dto:BlogCreateDto、BlogDto、BlogUpdateDto
+5. 在配置文件中编写数据库连接字符串
+```
+ "ConnectionStrings": {
+ "SqlServer": "server=.;database=BlogDemo;uid=sa;pwd=123456;TrustServerCertificate=true;"
+ }
+```
+6. 创建数据库上下文,连接数据库Db/BlogsDbContext
+7. 创建通用仓储接口Interfaces/IRepositoryBase.cs
+8. 实现接口Services/RepositoryBase.cs
+9. 编写控制器
+10. 生成迁移和同步数据库
+```
+// 全局安装dotnet-ef工具
+dotnet tool install --global dotnet-ef
+// 生成迁移
+dotnet ef migrations add