/// <summary>
        /// Convert Late Bound Expression to CLR Expression
        /// </summary>
        /// <param name="ex">The Expression</param>
        /// <param name="provider">The IDSQP provider instance</param>
        /// <returns>The converted expression with no latebound methods</returns>
        public static Expression ToClrExpression(Expression ex, IDataServiceQueryProvider provider)
        {
            if (OpenTypeMethodsImplementation == null)
            {
                OpenTypeMethodsImplementation = new DefaultOpenTypeMethodsImplementation();
            }

            if (DSPMethodsImplementation == null)
            {
                DSPMethodsImplementation = new DefaultDSPMethodsImplementation();
            }

            OpenTypeMethodsImplementation.QueryProvider = provider;
            DSPMethodsImplementation.QueryProvider = provider;
            LateBoundExpressionVisitor visitor = new LateBoundExpressionVisitor(OpenTypeMethodsImplementation, DSPMethodsImplementation);
            return visitor.Visit(ex);
        }
Beispiel #2
0
        /// <summary>
        /// Convert Late Bound Expression to CLR Expression
        /// </summary>
        /// <param name="ex">The Expression</param>
        /// <param name="provider">The IDSQP provider instance</param>
        /// <returns>The converted expression with no latebound methods</returns>
        public static Expression ToClrExpression(Expression ex, IDataServiceQueryProvider provider)
        {
            if (OpenTypeMethodsImplementation == null)
            {
                OpenTypeMethodsImplementation = new DefaultOpenTypeMethodsImplementation();
            }

            if (DSPMethodsImplementation == null)
            {
                DSPMethodsImplementation = new DefaultDSPMethodsImplementation();
            }

            OpenTypeMethodsImplementation.QueryProvider = provider;
            DSPMethodsImplementation.QueryProvider      = provider;
            LateBoundExpressionVisitor visitor = new LateBoundExpressionVisitor(OpenTypeMethodsImplementation, DSPMethodsImplementation);

            return(visitor.Visit(ex));
        }