mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
补充 开放 IUpdate UpdateColumns 方法功能;
现实更新实体时,只更新指定的列(与 IgnoreColumns 对应);
This commit is contained in:
@ -49,6 +49,11 @@ namespace FreeSql.Tests.PostgreSQL {
|
||||
Assert.Equal("UPDATE \"tb_topic\" SET \"title\" = @p_0 WHERE (\"id\" = 1)", sql);
|
||||
}
|
||||
[Fact]
|
||||
public void UpdateColumns() {
|
||||
var sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).UpdateColumns(a => a.Title).ToSql().Replace("\r\n", "");
|
||||
Assert.Equal("UPDATE \"tb_topic\" SET \"title\" = @p_0 WHERE (\"id\" = 1)", sql);
|
||||
}
|
||||
[Fact]
|
||||
public void Set() {
|
||||
var sql = update.Where(a => a.Id == 1).Set(a => a.Title, "newtitle").ToSql().Replace("\r\n", "");
|
||||
Assert.Equal("UPDATE \"tb_topic\" SET \"title\" = @p_0 WHERE (\"id\" = 1)", sql);
|
||||
|
Reference in New Issue
Block a user