Exemplo n.º 1
0
        public Action <string, TItem> Generate <TProperty>(Expression <Func <TItem, TProperty> > propFunc, Expression <Func <string, TProperty> > converter)
        {
            var assignExpression = CreatePropertySetterExpression(propFunc);

            var generator = new CustomConverterActionGenerator <TItem, TProperty>(assignExpression, converter);

            return(generator.Generate());
        }
Exemplo n.º 2
0
        public Action <string, string, TItem> Generate <TProperty>(Expression <Func <TItem, TProperty> > propFunc, Expression <Func <string, string, TProperty> > converter)
        {
            var property = propFunc.Body as MemberExpression;

            if (property == null)
            {
                throw new ArgumentException("Expression does not represent a Property.");
            }

            var generator = new CustomConverterActionGenerator <TItem, TProperty, string, string>((PropertyInfo)property.Member,
                                                                                                  converter);

            return(generator.Generate());
        }