Esempio n. 1
0
        /// <summary>
        /// Gets the aggregate properties and stores them into a Dictionary object.
        /// Property is defined as : {aggregate}__{field name}  Example : count__Firstname
        /// </summary>
        /// <param name="self">The self.</param>
        /// <returns>Dictionary</returns>
        public static object GetAggregatesAsDictionary(this DynamicClass self)
        {
            var dataItems = self.GetDataItems("Aggregates");

            // Group by the field and return an anonymous dictionary
            return(dataItems
                   .GroupBy(groupBy => groupBy.Fieldname)
                   .ToDictionary(x => x.Key, y => y.ToDictionary(k => k.Prefix, v => v.Value))
                   );
        }