private Expression FindProviderInExpression(Expression expression)
            {
                Expression expression2 = TypedSubtreeFinder.Find(expression, typeof(IQueryProvider));

                if (expression2 == null)
                {
                    expression2 = TypedSubtreeFinder.Find(expression, typeof(IQueryable));
                }
                return(expression2);
            }
Example #2
0
        private IQueryProvider FindProvider(Expression expression)
        {
            ConstantExpression expression2 = TypedSubtreeFinder.Find(expression, typeof(IQueryProvider)) as ConstantExpression;

            if (expression2 == null)
            {
                expression2 = TypedSubtreeFinder.Find(expression, typeof(IQueryable)) as ConstantExpression;
            }
            if (expression2 != null)
            {
                IQueryProvider provider = expression2.Value as IQueryProvider;
                if (provider == null)
                {
                    IQueryable queryable = expression2.Value as IQueryable;
                    if (queryable != null)
                    {
                        provider = queryable.Provider;
                    }
                }
                return(provider);
            }
            return(null);
        }