internal static ClientQueryableResult <T> Retrieve <T>(ClientQueryable <T> clientQueryable) where T : ClientObject
        {
            Expression expression = clientQueryable.Expression;
            ClientQueryableResult <T> clientQueryableResult           = new ClientQueryableResult <T>();
            ClientObject rootClientObjectForClientQueryableExpression = DataRetrieval.GetRootClientObjectForClientQueryableExpression(expression);

            if (rootClientObjectForClientQueryableExpression == null)
            {
                throw new InvalidQueryExpressionException();
            }
            ClientQueryInternal clientQueryInternal = new ClientQueryInternal(rootClientObjectForClientQueryableExpression, null, false, null);

            rootClientObjectForClientQueryableExpression.Context.AddQueryIdAndResultObject(clientQueryInternal.Id, clientQueryableResult);
            rootClientObjectForClientQueryableExpression.Context.AddQuery(clientQueryInternal);
            DataRetrieval.QueryProcessInfo      queryProcessInfo      = new DataRetrieval.QueryProcessInfo();
            DataRetrieval.QueryMethodAggregator queryMethodAggregator = new DataRetrieval.QueryMethodAggregator(expression);
            DataRetrieval.ProcessQueryExpression(clientQueryInternal, rootClientObjectForClientQueryableExpression, expression, false, queryProcessInfo, queryMethodAggregator);
            queryMethodAggregator.Check();
            if (queryMethodAggregator.Include == 0)
            {
                clientQueryInternal.ChildItemQuery.SelectAllProperties();
            }
            queryProcessInfo.FinalProcess();
            return(clientQueryableResult);
        }
Beispiel #2
0
        public IEnumerable <T> LoadQuery <T>(ClientObjectCollection <T> clientObjects) where T : ClientObject
        {
            if (clientObjects == null)
            {
                throw new ArgumentNullException("clientObjects");
            }
            ClientAction.CheckActionParameterInContext(this, clientObjects);
            ClientQueryableResult <T> clientQueryableResult = new ClientQueryableResult <T>();
            ClientQueryInternal       clientQueryInternal   = new ClientQueryInternal(clientObjects, null, false, null);

            clientQueryInternal.ChildItemQuery.SelectAllProperties();
            clientObjects.Context.AddQueryIdAndResultObject(clientQueryInternal.Id, clientQueryableResult);
            clientObjects.Context.AddQuery(clientQueryInternal);
            return(clientQueryableResult);
        }