- 完善 IUpdate.SetSource 组合主键的数据更新单元测试;

This commit is contained in:
28810
2020-02-24 18:03:37 +08:00
parent 05d1828884
commit 02cd7ad557
28 changed files with 375 additions and 209 deletions

View File

@ -51,6 +51,19 @@ namespace FreeSql.Tests.Odbc.SqlServer
sql = update.SetSource(items).IgnoreColumns(a => a.TypeGuid).Set(a => a.CreateTime, new DateTime(2020, 1, 1)).ToSql().Replace("\r\n", "");
Assert.Equal("UPDATE [tb_topic] SET [CreateTime] = '2020-01-01 00:00:00.000' WHERE ([Id] IN (1,2,3,4,5,6,7,8,9,10))", sql);
sql = g.sqlserver.Update<ts_source_mpk>().SetSource(new[] {
new ts_source_mpk { id1 = 1, id2 = 7, xx = "a1" },
new ts_source_mpk { id1 = 1, id2 = 8, xx = "b122" }
}).NoneParameter().ToSql().Replace("\r\n", "");
}
public class ts_source_mpk
{
[Column(IsPrimary = true)]
public int id1 { get; set; }
[Column(IsPrimary = true)]
public int id2 { get; set; }
public string xx { get; set; }
}
[Fact]
public void IgnoreColumns()