mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-17 05:40:56 +08:00
update
21
实体特性.md
21
实体特性.md
@@ -5,15 +5,12 @@ v1.4.0+ 已自动识别 EFCore 实体特性 Key/Required/NotMapped/MaxLength/Str
|
||||
|
||||
```csharp
|
||||
[Table(Name = "tb_topic")]
|
||||
class Topic
|
||||
{
|
||||
//...
|
||||
}
|
||||
class Topic { }
|
||||
```
|
||||
|
||||
> 架构:[Table(Name = "dbo.tb_topic")]
|
||||
架构:\[Table(Name = "dbo.tb_topic")\]
|
||||
|
||||
> 注意:带点的表名,使用 [Table(Name = "\`sys.config\`")] 解决
|
||||
注意:带点的表名,使用 \[Table(Name = "\`sys.config\`")\] 解决
|
||||
|
||||
> 指定表名的几种方法,优先级从小到大:
|
||||
|
||||
@@ -23,17 +20,9 @@ class Topic
|
||||
- 4、[Table(Name = "public.tabname")]
|
||||
- 5、AsTable fsql.Select<T>().AsTable((_, old) => "public.tabname").ToList()
|
||||
|
||||
修改表名,须指定旧的表名:
|
||||
改名:须指定旧的表名:\[Table(OldName = "Topic")\]
|
||||
|
||||
```csharp
|
||||
[Table(OldName = "Topic")]
|
||||
class Topic2
|
||||
{
|
||||
//...
|
||||
}
|
||||
```
|
||||
|
||||
> 实体的属性也有相同的功能,[Column(Name = "xxx")]
|
||||
> 属性名称:\[Column(Name = "xxx")\]
|
||||
|
||||
## 主键(Primary Key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user