mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 优化 SetSource 机制不更新主键字段;
This commit is contained in:
@ -179,7 +179,7 @@ namespace FreeSql.Tests.DataAnnotations
|
||||
item.title = "testtitle_update";
|
||||
item.testfield2 = 0;
|
||||
sql = g.mysql.Update<TestCanInsert>().SetSource(item).ToSql().Replace("\r\n", "");
|
||||
Assert.Equal($"UPDATE `TestCanInsert` SET `id` = ?p_0, `title` = ?p_1, `testfield1` = ?p_2 WHERE (`id` = '{item.id}')", sql);
|
||||
Assert.Equal($"UPDATE `TestCanInsert` SET `title` = ?p_0, `testfield1` = ?p_1 WHERE (`id` = '{item.id}')", sql);
|
||||
|
||||
Assert.Equal(1, g.mysql.Update<TestCanInsert>().SetSource(item).ExecuteAffrows());
|
||||
find = g.mysql.Select<TestCanInsert>().Where(a => a.id == item.id).First();
|
||||
|
Reference in New Issue
Block a user