/// <summary>
        /// Converts the specified expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="annotations">The annotations.</param>
        /// <param name="metadataMapping">The metadata mapping.</param>
        /// <returns></returns>
        public static ExpressionConversionResult Convert(Expression expression, ExpressionResourceAnnotations annotations, DSPMetadata metadataMapping)
        {
            Debug.Assert(annotations != null, "annotations != null");
            Debug.Assert(metadataMapping != null, "metadataMapping != null");

            expression = ResourceAnnotationVisitor.Convert(expression, annotations);

            ExpressionConversionResult result = ConvertInnerExpression(expression, annotations, metadataMapping);

            expression = ExpressionSimplifier.Simplify(result.Expression);

            result.SetResultExpression(expression);
            return(result);
        }
        /// <summary>Converts the specified expression and annotates it.</summary>
        /// <param name="expr">The expression to process.</param>
        /// <param name="annotations">Annotations object to store the annotations in.</param>
        /// <returns>The converted expression which will contain only CLR way of accessing properties.</returns>
        internal static Expression Convert(Expression expr, ExpressionResourceAnnotations annotations)
        {
            ResourceAnnotationVisitor visitor = new ResourceAnnotationVisitor(annotations);

            return(visitor.Visit(expr));
        }