mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 ISelect.ToSql 字段别名设置,默认为 AsIndex,可改为 AsProperty;#158
This commit is contained in:
@ -1006,6 +1006,24 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Min(a => a.Id);
|
||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Sum(a => a.Id);
|
||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Avg(a => a.Id);
|
||||
|
||||
var sqlsss = select
|
||||
.AsTable((type, old) => type == typeof(Topic) ? $"{old}_1" : null)
|
||||
.AsTable((type, old) => type == typeof(Topic) ? $"{old}_2" : null)
|
||||
.ToSql(a => new
|
||||
{
|
||||
a.Id,
|
||||
a.Clicks
|
||||
}, FieldAliasOptions.AsProperty);
|
||||
|
||||
var slsld3 = select
|
||||
.AsTable((type, old) => type == typeof(Topic) ? $"({sqlsss})" : null)
|
||||
.Page(1, 20)
|
||||
.ToList(a => new
|
||||
{
|
||||
a.Id,
|
||||
a.Clicks
|
||||
});
|
||||
}
|
||||
|
||||
public class TestInclude_OneToManyModel1
|
||||
|
Reference in New Issue
Block a user