- 修复 CodeFirst IsPrimary NOT NULL 生成,sqlite 可以插入 NULL 到主键;

This commit is contained in:
2881099
2022-08-26 15:38:34 +08:00
parent aa35f92a13
commit d154a463a5
3 changed files with 233 additions and 185 deletions

View File

@ -516,7 +516,7 @@ namespace FreeSql.Internal
foreach (var col in trytb.Primarys)
{
col.Attribute.IsNullable = false;
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim();
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim() + " NOT NULL"; //sqlite 主键也可以插入 null
}
foreach (var col in trytb.Columns.Values)
{
@ -956,7 +956,7 @@ namespace FreeSql.Internal
foreach (var col in tbmid.Primarys)
{
col.Attribute.IsNullable = false;
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim();
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim() + " NOT NULL"; //sqlite 主键也可以插入 null
}
}
}