- 增加 ISelect.ToSql 字段别名设置,默认为 AsIndex,可改为 AsProperty;#158

This commit is contained in:
28810
2019-12-17 22:08:12 +08:00
parent 204b6ecd98
commit fe5b98509b
37 changed files with 309 additions and 45 deletions

View File

@ -922,6 +922,24 @@ WHERE (((to_char(a.""ID"")) 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 TiOtmModel1

View File

@ -887,6 +887,24 @@ WHERE (((cast(a.[Id] as nvarchar)) 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

View File

@ -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

View File

@ -922,6 +922,24 @@ WHERE (((to_char(a.""ID"")) 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 TiOtmModel1

View File

@ -978,6 +978,24 @@ WHERE ((((a.""id"")::varchar) 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

View File

@ -868,6 +868,24 @@ WHERE (((cast(a.[Id] as nvarchar)) 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