data is ready next is to regroup into a result :)
This commit is contained in:
parent
244130c4cb
commit
01de3b480b
@ -79,7 +79,7 @@ namespace PoweredSoft.DynamicQuery.Cli
|
|||||||
var queryable = list.AsQueryable();
|
var queryable = list.AsQueryable();
|
||||||
var criteria = new QueryCriteria();
|
var criteria = new QueryCriteria();
|
||||||
criteria.Page = 1;
|
criteria.Page = 1;
|
||||||
criteria.PageSize = 10;
|
criteria.PageSize = 2;
|
||||||
|
|
||||||
criteria.Groups = new List<IGroup>()
|
criteria.Groups = new List<IGroup>()
|
||||||
{
|
{
|
||||||
|
@ -39,19 +39,16 @@ namespace PoweredSoft.DynamicQuery
|
|||||||
{
|
{
|
||||||
var groupExpression = CurrentQueryable.GroupBy(QueryableUnderlyingType, gb =>
|
var groupExpression = CurrentQueryable.GroupBy(QueryableUnderlyingType, gb =>
|
||||||
{
|
{
|
||||||
previousGroups.ForEach(pg =>
|
var groupKeyIndex = -1;
|
||||||
{
|
previousGroups.ForEach(pg =>gb.Path(pg.Path, $"Key_{++groupKeyIndex}"));
|
||||||
var previousGroupCleanedPath = pg.Path.Replace(".", "");
|
gb.Path(fg.Path, $"Key_{++groupKeyIndex}");
|
||||||
gb.Path(pg.Path, $"Key_{previousGroupCleanedPath}");
|
|
||||||
});
|
|
||||||
var cleanedPath = fg.Path.Replace(".", "");
|
|
||||||
gb.Path(fg.Path, $"Key_{cleanedPath}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var selectExpression = groupExpression.Select(sb =>
|
var selectExpression = groupExpression.Select(sb =>
|
||||||
{
|
{
|
||||||
previousGroups.ForEach(pg => sb.Key(pg.Path));
|
var groupKeyIndex = -1;
|
||||||
sb.Key(fg.Path);
|
previousGroups.ForEach(pg => sb.Key($"Key_{++groupKeyIndex}"));
|
||||||
|
sb.Key($"Key_{++groupKeyIndex}");
|
||||||
Criteria.Aggregates.ForEach(a =>
|
Criteria.Aggregates.ForEach(a =>
|
||||||
{
|
{
|
||||||
var selectType = ResolveSelectFrom(a.Type);
|
var selectType = ResolveSelectFrom(a.Type);
|
||||||
@ -80,10 +77,10 @@ namespace PoweredSoft.DynamicQuery
|
|||||||
ApplyPaging<T>();
|
ApplyPaging<T>();
|
||||||
|
|
||||||
// now get the data grouped.
|
// now get the data grouped.
|
||||||
CurrentQueryable = CurrentQueryable.GroupBy(QueryableUnderlyingType, gb => finalGroups.ForEach(fg => gb.Path(fg.Path)));
|
CurrentQueryable = CurrentQueryable.GroupBy(QueryableUnderlyingType, gb => finalGroups.ForEach((fg, index) => gb.Path(fg.Path, $"Key_{index}")));
|
||||||
CurrentQueryable = CurrentQueryable.Select(sb =>
|
CurrentQueryable = CurrentQueryable.Select(sb =>
|
||||||
{
|
{
|
||||||
finalGroups.ForEach(fg => sb.Key(fg.Path));
|
finalGroups.ForEach((fg, index) => sb.Key($"Key_{index}"));
|
||||||
sb.ToList("Records");
|
sb.ToList("Records");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user