From 8574f2561a2506f0cde1ed9c8304a48794006ec5 Mon Sep 17 00:00:00 2001 From: hello Date: Sat, 23 Nov 2024 08:58:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/helloshop/efcore-naming-conventions.md | 11 +++++++++++ notes/helloshop/use-time-provider.md | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/notes/helloshop/efcore-naming-conventions.md b/notes/helloshop/efcore-naming-conventions.md index abada0a..5e28323 100644 --- a/notes/helloshop/efcore-naming-conventions.md +++ b/notes/helloshop/efcore-naming-conventions.md @@ -2,6 +2,17 @@ 不同数据库对象的命名约定不同,EF Core 为了适配不同数据库,提供了一些命名约定的配置选项。 +## 常见的命名方法 + +| Naming policy | Original | Converted | +|----------------|--------------|--------------| +| PascalCase | HelloShop | HelloShop | +| CamelCase | HelloShop | helloShop | +| SnakeCaseLower | HelloShop | hello_shop | +| SnakeCaseUpper | HelloShop | HELLO_SHOP | +| KebabCaseLower | HelloShop | hello-shop | +| KebabCaseUpper | HelloShop | HELLO-SHOP | + ## 手动指定表名和列名 ### 表名 diff --git a/notes/helloshop/use-time-provider.md b/notes/helloshop/use-time-provider.md index 121f824..a2b1697 100644 --- a/notes/helloshop/use-time-provider.md +++ b/notes/helloshop/use-time-provider.md @@ -37,7 +37,7 @@ public class MyTimeProvider : TimeProvider 默认实现 TimeProvider.System 使用系统时间。 ```csharp -builder.Services.AddSingleton(TimeProvider.System); +builder.Services.AddSingleton(TimeProvider.System); ``` 注入 MyTimeProvider 使用自定义时间。