Exemplo n.º 1
0
        public static OpenTypeMethodsImplementation GetImplementation(OpenTypeMethodsImplementations type, bool lazyEvaluation)
        {
            OpenTypeMethodsImplementation impl = null;

            switch (type)
            {
            case OpenTypeMethodsImplementations.Default:
                impl = new DefaultOpenTypeMethodsImplementation();
                break;

            case OpenTypeMethodsImplementations.Realistic:
                impl = new RealisticOpenTypeMethodsImplementation();
                break;

            case OpenTypeMethodsImplementations.Tolerant:
                impl = new TolerantOpenTypeMethodsImplementation();
                break;

            default:
                return(null);
            }

            impl.UseLazyBooleanEvaluation = lazyEvaluation;
            return(impl);
        }
Exemplo n.º 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));
        }