- 完善 ISelect<T>.WithSql 方法,支持传入参数化 #413;

This commit is contained in:
28810
2020-08-13 10:25:01 +08:00
parent ae56952621
commit 5f645f194f
4 changed files with 23 additions and 158 deletions

View File

@ -1043,14 +1043,23 @@ WHERE (((cast(a.[Id] as nvarchar(100))) in (SELECT b.[Title]
});
var testUnionAll = select
.WithSql("SELECT * FROM [tb_topic22] where id = 10")
.WithSql("SELECT * FROM [tb_topic22] where id = 11")
.WithSql("SELECT * FROM [tb_topic22] where id = @id1", new { id1 = 10 })
.WithSql("SELECT * FROM [tb_topic22] where id = @id2", new { id2 = 11 })
.ToSql(a => new
{
a.Id,
a.Clicks
});
var testUnionAllToList = select
.WithSql("SELECT * FROM [tb_topic22] where id = @id1", new { id1 = 10 })
.WithSql("SELECT * FROM [tb_topic22] where id = @id2", new { id2 = 11 })
.ToList(a => new
{
a.Id,
a.Clicks
});
var testUnionAll2 = g.sqlite.Select<object>()
.WithSql("SELECT * FROM [tb_topic22] where id = 10")
.WithSql("SELECT * FROM [tb_topic22] where id = 11")