Exemplo n.º 1
0
        public static Expression Find(Expression expression, Type type)
        {
            var finder = new TypedSubtreeFinder(type);

            finder.Visit(expression);
            return(finder.root);
        }
Exemplo n.º 2
0
            private Expression FindProviderInExpression(Expression expression)
            {
                Expression root = TypedSubtreeFinder.Find(expression, typeof(IQueryProvider));

                if (root == null)
                {
                    root = TypedSubtreeFinder.Find(expression, typeof(IQueryable));
                }
                return(root);
            }
Exemplo n.º 3
0
        private IQueryProvider FindProvider(Expression expression)
        {
            var root = TypedSubtreeFinder.Find(expression, typeof(IQueryProvider)) as ConstantExpression;

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