mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 优化 IsNullable = false 插入的数据值为 null 则以默认值插入(防止DB报错);#384
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user