Example #1
0
        internal void AutoMapColumnsAction <T>(params Expression <Func <T, object> >[] ignorePropertyExpressions)
        {
            VerifyAutoMapAlreadyCalled();

            var properties          = ReflectionHelper.GetProperties(_data.Item.GetType());
            var ignorePropertyNames = new HashSet <string>();

            if (ignorePropertyExpressions != null)
            {
                foreach (var ignorePropertyExpression in ignorePropertyExpressions)
                {
                    var ignorePropertyName = new PropertyExpressionParser <T>(_data.Item, ignorePropertyExpression).Name;
                    ignorePropertyNames.Add(ignorePropertyName);
                }
            }

            foreach (var property in properties)
            {
                var ignoreProperty = ignorePropertyNames.SingleOrDefault(x => x.Equals(property.Value.Name, StringComparison.CurrentCultureIgnoreCase));
                if (ignoreProperty != null)
                {
                    continue;
                }

                var propertyType = ReflectionHelper.GetPropertyType(property.Value);

                var propertyValue = ReflectionHelper.GetPropertyValue(_data.Item, property.Value);
                ColumnAction(property.Value.Name, propertyValue, propertyType, DataTypes.Object, 0);
            }
        }
Example #2
0
        internal void ColumnValueAction <T>(Expression <Func <T, object> > expression, DataTypes parameterType, int size)
        {
            var parser = new PropertyExpressionParser <T>(_data.Item, expression);

            ColumnAction(parser.Name, parser.Value, parser.Type, parameterType, size);
        }