- 修复 IgnoreColumns 相关方法解析表达式 a => new [] { "Id" .. } 无效的 bug;

This commit is contained in:
28810
2020-05-10 06:23:00 +08:00
parent a9ee9aa069
commit 54ceefefd2
2 changed files with 17 additions and 3 deletions

View File

@ -69,6 +69,20 @@ namespace FreeSql.Tests.Sqlite
{
var sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).IgnoreColumns(a => new { a.Clicks, a.CreateTime, a.TypeGuid }).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE \"tb_topic\" SET \"Title\" = @p_0 WHERE (\"Id\" = 1)", sql);
sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).IgnoreColumns(a => new object[] { a.Clicks, a.CreateTime, a.TypeGuid }).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE \"tb_topic\" SET \"Title\" = @p_0 WHERE (\"Id\" = 1)", sql);
sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).IgnoreColumns(a => new[] { "Clicks", "CreateTime", "TypeGuid" }).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE \"tb_topic\" SET \"Title\" = @p_0 WHERE (\"Id\" = 1)", sql);
var cols = new[] { "Clicks", "CreateTime", "TypeGuid" };
sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).IgnoreColumns(a => cols).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE \"tb_topic\" SET \"Title\" = @p_0 WHERE (\"Id\" = 1)", sql);
cols = new[] { "Clicks", "CreateTime", "TypeGuid" };
sql = update.SetSource(new Topic { Id = 1, Title = "newtitle" }).IgnoreColumns(cols).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE \"tb_topic\" SET \"Title\" = @p_0 WHERE (\"Id\" = 1)", sql);
}
[Fact]
public void UpdateColumns()