aggregate support.

This commit is contained in:
David Lebee 2018-10-21 15:20:17 -05:00
parent 7a8ee0895c
commit 94d241590e
2 changed files with 14 additions and 0 deletions

View File

@ -82,6 +82,18 @@ namespace PoweredSoft.DynamicQuery
{
var matchingAggregate = FindMatchingAggregateResult(aggregateResults, previousGroups, previousGroupResults);
cgrr.Aggregates = new List<IAggregateResult>();
Criteria.Aggregates.ForEach(a =>
{
var pathCleaned = a.Path?.Replace(".", "");
var key = $"Agg_{a.Type}_{pathCleaned}";
var aggregateResult = new AggregateResult
{
Path = a.Path,
Type = a.Type,
Value = matchingAggregate.GetDynamicPropertyValue(key)
};
cgrr.Aggregates.Add(aggregateResult);
});
}
});

View File

@ -14,6 +14,8 @@ namespace PoweredSoft.DynamicQuery
public string Path { get; set; }
public AggregateType Type { get; set; }
public object Value { get; set; }
public bool ShouldSerializePath() => !string.IsNullOrWhiteSpace(Path);
}
// part of a result.