/// <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="DSPIQUpdateProvider"/> class.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="metadata">The metadata.</param>
        /// <param name="session">The session.</param>
        public DSPIQUpdateProvider(DbEntityProvider provider, DSPMetadata metadata, IEntitySession session)
        {
            if (provider == null)
            {
                throw new ArgumentException("The specified provider is null.");
            }
            if (metadata == null)
            {
                throw new ArgumentException("The specified metadata is null.");
            }
            if (session == null)
            {
                throw new ArgumentException("The specified session is null.");
            }


            this.metadata       = metadata;
            this.provider       = provider;
            this.session        = session;
            this.pendingChanges = new List <Action>();
        }
        /// <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>
 /// 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;
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DSPResourceQueryProvider"/> class.
 /// </summary>
 /// <param name="metadata">The metadata.</param>
 public DSPResourceQueryProvider(DSPMetadata metadata)
 {
     this.metadata = metadata;
 }
 /// <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)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DSPIQUpdateProvider"/> class.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="metadata">The metadata.</param>
 public DSPIQUpdateProvider(DbEntityProvider provider, DSPMetadata metadata) :
     this(provider, metadata, new EntitySession(provider))
 {
 }