- 增加 ISelect.ToDataTable 系列方法;

- 增加 无参数化命令执行,便于调试;
This commit is contained in:
28810
2019-03-13 18:24:54 +08:00
parent aa2040a629
commit 1fa6c9bfc4
50 changed files with 676 additions and 331 deletions

View File

@ -85,10 +85,23 @@ namespace FreeSql.Tests.MySql {
.ToSql();
var songs = g.mysql.Select<Song>().Limit(10).ToList();
}
[Fact]
public void ToDataTable() {
var items = new List<Topic>();
for (var a = 0; a < 10; a++) items.Add(new Topic { Id = a + 1, Title = $"newtitle{a}", Clicks = a * 100, CreateTime = DateTime.Now });
Assert.Equal(1, g.mysql.Insert<Topic>().AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, g.mysql.Insert<Topic>().AppendData(items).ExecuteAffrows());
items = Enumerable.Range(0, 9989).Select(a => new Topic { Title = "newtitle" + a, CreateTime = DateTime.Now }).ToList();
Assert.Equal(9989, g.mysql.Insert<Topic>(items).ExecuteAffrows());
var dt1 = select.Limit(10).ToDataTable();
var dt2 = select.Limit(10).ToDataTable("id, 111222");
var dt3 = select.Limit(10).ToDataTable(a => new { a.Id, a.Type.Name, now = DateTime.Now });
}
[Fact]
public void ToList() {
var t0 = select.Limit(50).ToList();