mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-10 16:10:56 +08:00
update
4
实体特性.md
4
实体特性.md
@@ -64,11 +64,13 @@ class Topic {
|
||||
|
||||
```csharp
|
||||
class Topic {
|
||||
[Column(IsNullable = false), MaxLength(128)]
|
||||
[MaxLength(128)]
|
||||
public string Title { get; set; }
|
||||
}
|
||||
```
|
||||
|
||||
MaxLengthAttribute 可以在任意地方定义,因为内部采用反射查找方法。该特性通常定义在 System.ComponentModel.DataAnnotations.MaxLengthAttribute,但如果找不到该类,可自行在项目中定义名称为 MaxLengthAttribute 的特性类,和它的属性 public int Length。
|
||||
|
||||
## 可空(Nullable)
|
||||
|
||||
```csharp
|
||||
|
||||
Reference in New Issue
Block a user