/// <summary>
 /// Initializes a new instance of the <see cref="DSPIQALinqQueryProvider"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="underlyingQueryProvider">The underlying query provider.</param>
 /// <param name="resourceSet">The resource set.</param>
 public DSPIQALinqQueryProvider(IContext context, IQueryProvider underlyingQueryProvider, ResourceSet resourceSet)
 {
     this.underlyingQueryProvider = underlyingQueryProvider;
     this.context     = context;
     this.annotations = new ExpressionResourceAnnotations();
     this.resourceSet = resourceSet;
 }
 /// <summary>
 /// Prevents a default instance of the <see cref="DSPIQALinqQueryProvider"/> class from being created.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="underlyingQueryProvider">The underlying query provider.</param>
 private DSPIQALinqQueryProvider(IContext context, IQueryProvider underlyingQueryProvider)
 {
     Debug.Assert(context != null, "context != null");
     Debug.Assert(underlyingQueryProvider != null, "underlyingQueryProvider != null");
     this.context = context;
     this.underlyingQueryProvider = underlyingQueryProvider;
     this.annotations             = new ExpressionResourceAnnotations();
 }
        /// <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 inner expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="annotations">The annotations.</param>
        /// <param name="contextMapping">The context mapping.</param>
        /// <returns></returns>
        private static ExpressionConversionResult ConvertInnerExpression(
            Expression expression,
            ExpressionResourceAnnotations annotations,
            DSPMetadata contextMapping)
        {
            Debug.Assert(expression != null, "expression != null");
            Debug.Assert(annotations != null, "annotations != null");
            Debug.Assert(contextMapping != null, "contextMapping != null");

            ExpressionConversionResult result = new ExpressionConversionResult(expression);

            FilterConverter filterConverter = new FilterConverter(annotations, contextMapping);

            result = filterConverter.Convert(result);

            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpressionConverter"/> class.
 /// </summary>
 /// <param name="annotations">The annotations.</param>
 /// <param name="metadataMapping">The metadata mapping.</param>
 public ExpressionConverter(ExpressionResourceAnnotations annotations, DSPMetadata metadataMapping)
     : base(annotations)
 {
     Debug.Assert(metadataMapping != null, "metadataMapping != null");
     this.metadataMapping = metadataMapping;
 }
 /// <summary>Constructor.</summary>
 /// <param name="annotations">Annotations to use and modify.</param>
 public ResourceAnnotationPreservingExpressionVisitor(ExpressionResourceAnnotations annotations)
 {
     Debug.Assert(annotations != null, "annotations != null");
     this.annotations = annotations;
 }
        /// <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));
        }
 /// <summary>Constructor.</summary>
 /// <param name="annotations">Annotations to use and modify.</param>
 private ResourceAnnotationVisitor(ExpressionResourceAnnotations annotations)
     : base(annotations)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterConverter"/> class.
 /// </summary>
 /// <param name="annotations">The annotations.</param>
 /// <param name="contextMapping">The context mapping.</param>
 public FilterConverter(ExpressionResourceAnnotations annotations, DSPMetadata contextMapping)
     : base(annotations, contextMapping)
 {
 }