Пример #1
0
        object GetDefaultValue(string selector)
        {
            if (_defaultValues == null)
            {
                _defaultValues = new Dictionary <string, object>();
            }

            if (!_defaultValues.ContainsKey(selector))
            {
                var expr = CompileAccessorExpression(_typeParam, selector);
                var acc  = AccumulatorFactory.Create(Utils.StripNullableType(expr.Type));
                _defaultValues[selector] = acc.GetValue();
            }

            return(_defaultValues[selector]);
        }
        public override void Step(T container, string selector)
        {
            var value = Accessor.Read(container, selector);

            if (value != null)
            {
                if (_accumulator == null)
                {
                    _accumulator = AccumulatorFactory.Create(value.GetType());
                }

                try {
                    _accumulator.Add(value);
                } catch (FormatException) {
                } catch (InvalidCastException) {
                }
            }
        }