- 优化 IsNullable = false 插入的数据值为 null 则以默认值插入(防止DB报错);#384

This commit is contained in:
28810
2020-08-03 11:58:46 +08:00
parent 2f254d23f9
commit 0b1865f7e7
7 changed files with 19 additions and 21 deletions

View File

@ -156,9 +156,23 @@ namespace FreeSql.Tests
}
}
class testInsertNullable
{
[Column(IsIdentity = true)]
public long Id { get; set; }
[Column(IsNullable = false)]
public string str1 { get; set; }
[Column(IsNullable = false)]
public int? int1 { get; set; }
}
[Fact]
public void Test03()
{
g.sqlite.Insert(new testInsertNullable()).NoneParameter().ExecuteAffrows();
var sqlxx = g.pgsql.InsertOrUpdate<userinfo>().SetSource(new userinfo { userid = 10 }).UpdateColumns(a => new { a.birthday, a.CardNo }).ToSql();
var aff1 = g.sqlite.GetRepository<Edi, long>().Delete(10086);