DotNetNext / SqlSugar

.Net aot ORM Fastest ORM Simple Easy VB.NET Sqlite orm Oracle ORM Mysql Orm 虚谷数据库 postgresql ORm SqlServer oRm 达梦 ORM 人大金仓 ORM 神通ORM C# ORM , C# ORM .NET ORM NET5 ORM .NET6 ORM ClickHouse orm QuestDb ,TDengine ORM,OceanBase orm,GaussDB orm ,Tidb orm Object/Relational Mapping
https://www.donet5.com/Home/Doc
MIT License
5.17k stars 1.32k forks source link

DBFrist可以添加required關鍵字嗎? #1243

Closed flier268 closed 1 month ago

flier268 commented 1 month ago

有一些欄位像是string,table設定NOT NULL,沒有加上required或者

public string Column { get; set; } = null!;

IDE會一直出現警告,要我在ctor加上預設值讓他不是null

DotNetNext commented 1 month ago

这个我支持 一下

DotNetNext commented 1 month ago

SqlSugarCore 5.1.4.155-preview22 勾一下预览版本已支持 启用stringnull的警告

flier268 commented 1 month ago

nuget上面只有到5.1.4.154

DotNetNext commented 1 month ago

勾了预览了吗

flier268 commented 1 month ago

對,我看到你發布的是 SqlSugarCore ,但我用 SqlSugarCoreNoDrive

DotNetNext commented 1 month ago

SqlSugarCoreNoDrive 5.1.4.155-preview22 过五分钟后安装

flier268 commented 1 month ago

為什麼不是 public string Column { get; set; } = null!; 或 public required string Column { get; set; }; 而是 public string Column { get; set; } = string.Empty; string.Empty看起來比較像是預設值為空,語義上比較不清楚,容易混淆

DotNetNext commented 1 month ago

可以全局替换的

DotNetNext commented 1 month ago

我处理一下吧

DotNetNext commented 1 month ago

SqlSugarCoreNoDrive 5.1.4.155-preview23 过五分钟后安装

flier268 commented 1 month ago

不錯不錯,IDE終於不會吵了,舒爽