private Func <TFrom, TTo> BuildConversion <TFrom, TTo>()
        {
            var inputParam = typeof(TFrom).CreateParameterExpression();
            var expression = ExpressionGenerator.GenerateConversion(typeof(TTo), inputParam);

            if (null == expression)
            {
                return(null);
            }
            return(Expression.Lambda <Func <TFrom, TTo> >(expression, inputParam).Compile());
        }
        private UnaryFunc BuildUnaryFunc <TReturn>(string expressionName)
        {
            Contract.Requires(!string.IsNullOrEmpty(expressionName));
            var tParam     = typeof(TValue).CreateParameterExpression();
            var expression = ExpressionGenerator.Generate(expressionName, tParam);

            if (null == expression)
            {
                return(null);
            }

            if (typeof(TReturn) != typeof(void) && typeof(TReturn) != expression.Type)
            {
                expression = ExpressionGenerator.GenerateConversion(typeof(TReturn), expression);
                if (null == expression)
                {
                    return(null);
                }
            }

            return(Expression.Lambda <UnaryFunc>(expression, tParam).Compile());
        }
        private TResult BuildBinaryFunc <TResult, TReturn>(string expressionName) where TResult : class
        {
            Contract.Requires(!string.IsNullOrEmpty(expressionName));
            var tParam0    = typeof(TValue).CreateParameterExpression();
            var tParam1    = typeof(TValue).CreateParameterExpression();
            var expression = ExpressionGenerator.Generate(expressionName, tParam0, tParam1);

            if (null == expression)
            {
                return(null);
            }

            if (typeof(TReturn) != typeof(void) && typeof(TReturn) != expression.Type)
            {
                expression = ExpressionGenerator.GenerateConversion(typeof(TReturn), expression);
                if (null == expression)
                {
                    return(null);
                }
            }

            return(Expression.Lambda <TResult>(expression, tParam0, tParam1).Compile());
        }