public QueryableObject(QueryProviderBase provider)
 {
     if (provider is null)
     {
         throw new ArgumentNullException("provider");
     }
     _provider   = provider;
     _expression = Expression.Constant(this);
 }
        public QueryableObject(QueryProviderBase provider, Expression expression)
        {
            if (provider is null)
            {
                throw new ArgumentNullException("provider");
            }

            if (expression is null)
            {
                throw new ArgumentNullException("expression");
            }

            if (!typeof(IQueryable <T>).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException("expression");
            }

            _provider   = provider;
            _expression = expression;
        }