public static IDictionary <string, object> ToDictionary(this DynamicClass entity)
        {
            var dic = new Dictionary <string, object>();

            foreach (var key in entity.GetDynamicMemberNames())
            {
                dic.Add(key, entity.GetDynamicPropertyValue(key));
            }

            return(dic);
        }
Пример #2
0
        protected virtual List <IAggregateResult> MaterializeCalculateTotalAggregateResult(DynamicClass aggregateResult)
        {
            var ret = new List <IAggregateResult>();

            Criteria.Aggregates.ForEach((a, index) =>
            {
                ret.Add(new AggregateResult()
                {
                    Path  = a.Path,
                    Type  = a.Type,
                    Value = aggregateResult?.GetDynamicPropertyValue($"Agg_{index}")
                });
            });
            return(ret);
        }