/// <summary>
        /// This method is a shortcut for building a lambda expression directly from an <see cref="ITarget" />.
        /// It calls <see cref="IExpressionCompiler.Build(ITarget, IExpressionCompileContext)" /> and passes the result to
        /// <see cref="IExpressionCompiler.BuildObjectFactoryLambda(Expression, IExpressionCompileContext)" />, which should yield an
        /// optimised lambda expression for the expression produced from the target which can then be
        /// compiled and used as the factory for that target.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="target">The target.</param>
        /// <param name="context">The current compilation context.</param>
        public static Expression <Func <ResolveContext, object> > BuildResolveLambda(this IExpressionCompiler compiler, ITarget target, IExpressionCompileContext context)
        {
            if (compiler == null)
            {
                throw new ArgumentNullException(nameof(compiler));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            var expression = compiler.Build(target, context);

            return(compiler.BuildObjectFactoryLambda(expression, context));
        }