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; } //valid DataColumn attribute to skip no operate column. var ats = property.Value.Attributes; var cts = property.Value.GetCustomAttributes(true); bool isBreak = false; foreach (var attr in cts) { IgnoreAttribute ign = attr as IgnoreAttribute; if (ign != null) { isBreak = true; break; } } if (isBreak) { continue; } var propertyType = ReflectionHelper.GetPropertyType(property.Value); var propertyValue = ReflectionHelper.GetPropertyValue(_data.Item, property.Value); ColumnAction(property.Value.Name, propertyValue, propertyType, DataTypes.Object, 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); }