Example #1
0
        private void DefineAggregationAction(TInput inputrow, TOutput aggOutput)
        {
            foreach (var attrmap in AggTypeInfo.AggregateColumns)
            {
                decimal?inputVal = ConvertToDecimal(attrmap.PropInInput.GetValue(inputrow));
                decimal?aggVal   = ConvertToDecimal(attrmap.PropInOutput.GetValue(aggOutput));
                decimal?res      = null;
                if (aggVal == null && attrmap.AggregationMethod == AggregationMethod.Count)
                {
                    res = 1;
                }
                else if (aggVal == null)
                {
                    res = inputVal;
                }
                else if (attrmap.AggregationMethod == AggregationMethod.Sum)
                {
                    res = (inputVal ?? 0) + aggVal;
                }
                else if (attrmap.AggregationMethod == AggregationMethod.Max)
                {
                    res = ((inputVal ?? 0) > aggVal) ? inputVal : aggVal;
                }
                else if (attrmap.AggregationMethod == AggregationMethod.Min)
                {
                    res = (inputVal ?? 0) < aggVal ? inputVal : aggVal;
                }
                else if (attrmap.AggregationMethod == AggregationMethod.Count)
                {
                    res = aggVal + 1;
                }

                object output = Convert.ChangeType(
                    res, TypeInfo.TryGetUnderlyingType(attrmap.PropInOutput));
                attrmap.PropInOutput.SetValueOrThrow(aggOutput, output);
            }
        }
Example #2
0
        private void AddUnderlyingType(PropertyInfo propInfo)
        {
            Type t = TypeInfo.TryGetUnderlyingType(propInfo);

            underlyingPropType.Add(propInfo, t);
        }