Exemple #1
0
        /// <summary>
        /// Converts a <see cref="string"/> pattern to <see cref="Expression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="string"/> pattern.</param>
        /// <returns>The <see cref="Expression"/> lambda expression.</returns>
        /// <exception cref="KeyNotFoundException">When the <see cref="ExpressionNodeType"/> is not implemented.</exception>
        public static Expression <Func <T, TResult> > Create(string expression)
        {
            var eb   = new ExpressionBuilder <T, TResult>();
            var root = ExpressionString.BuildTree(expression).Root;

            return(root == null ? null : eb.Lambda(eb.BuildExpression(root)));
        }
Exemple #2
0
        /// <summary>
        /// Converts a <see cref="String"/> expression to <see cref="ExpressionTree"/>.
        /// </summary>
        /// <param name="value">The <see cref="String"/> expression to parse.</param>
        /// <returns>The <see cref="ExpressionTree"/> parsed.</returns>
        public static ExpressionTree BuildTree(string value)
        {
            ExpressionTree tree;

            var fsp = new ExpressionString();

            tree = fsp.ParseExpressionString(value);
            return(tree);
        }