Example #1
0
        /// <summary>
        /// Creates a <see cref="IRootBinding{TGraph,TResult}"/> from an expression.
        /// </summary>
        /// <typeparam name="TGraph">The type of the object graph.</typeparam>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="expression">The source expression.</param>
        /// <returns>An equivalent <see cref="IRootBinding{T,TResult}"/>.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="expression"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// A node in <paramref name="expression"/> is not supported.
        /// </exception>
        public static IRootBinding <TGraph, TResult> Create <TGraph, TResult>(
            Expression <Func <TGraph, TResult> > expression)
        {
            Requires.NotNull(expression, "expression");

            return(RootBinding.From(expression));
        }
Example #2
0
        /// <summary>
        /// Creates a <see cref="IRootBindingPrototype{TGraph,TResult}"/> from an expression.
        /// </summary>
        /// <typeparam name="TGraph">The type of the object graph.</typeparam>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="expression">The source expression.</param>
        /// <returns>An equivalent <see cref="IRootBindingPrototype{T,TResult}"/>.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="expression"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="NotSupportedException">
        /// A node in <paramref name="expression"/> is not supported.
        /// </exception>
        public static IRootBindingPrototype <TGraph, TResult> CreatePrototype <TGraph, TResult>(
            Expression <Func <TGraph, TResult> > expression)
        {
            Requires.NotNull(expression, "expression");

            var binding = RootBinding.From(expression);

            return(new RootBindingPrototype <TGraph, TResult>(binding));
        }