예제 #1
0
        protected override void Execute(NativeActivityContext context)
        {
            var source       = SourceList.Get(context);
            var propertyName = PropertyName.Get(context);
            var properties   = TypeDescriptor.GetProperties(typeof(T));
            var property     = properties.Cast <PropertyDescriptor>().FirstOrDefault(i => i.Name.Equals(propertyName, System.StringComparison.InvariantCultureIgnoreCase));

            if (property == null)
            {
                throw new DeveloperException("Задан не верный параметр {0}", propertyName);
            }
            var sum = source.Sum(o => Convert.ToInt32(property.GetValue(o)));

            context.SetValue(Result, sum);
        }