Example #1
0
        public IndexQuery GetIndexQuery(bool isAsync = true)
        {
            RavenQueryProviderProcessor <T> ravenQueryProvider = GetRavenQueryProvider();

            if (isAsync == false)
            {
                var documentQuery = ravenQueryProvider.GetDocumentQueryFor(_expression);
                return(documentQuery.GetIndexQuery());
            }
            var asyncDocumentQuery = ravenQueryProvider.GetAsyncDocumentQueryFor(_expression);

            return(asyncDocumentQuery.GetIndexQuery());
        }
Example #2
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            RavenQueryProviderProcessor <T> ravenQueryProvider = GetRavenQueryProvider();
            string query;

            if (_session is AsyncDocumentSession)
            {
                var asyncDocumentQuery = ravenQueryProvider.GetAsyncDocumentQueryFor(_expression);
                query = asyncDocumentQuery.GetIndexQuery().ToString();
            }
            else
            {
                var documentQuery = ravenQueryProvider.GetDocumentQueryFor(_expression);
                query = documentQuery.ToString();
            }

            return(query);
        }
        ///<summary>
        /// Get the last equality term for the query
        ///</summary>
        public KeyValuePair <string, string> GetLastEqualityTerm(bool isAsync = false)
        {
            var ravenQueryProvider = new RavenQueryProviderProcessor <T>(provider.QueryGenerator, null, null, null, indexName, new HashSet <string>(),
                                                                         new List <RenamedField>(), isMapReduce, provider.ResultTransformer, provider.TransformerParameters, OriginalQueryType);

            if (isAsync)
            {
                if (isAsync)
                {
                    var asyncDocumentQuery = ravenQueryProvider.GetAsyncDocumentQueryFor(expression);
                    return(((IRavenQueryInspector)asyncDocumentQuery).GetLastEqualityTerm(true));
                }
            }

            var documentQuery = ravenQueryProvider.GetDocumentQueryFor(expression);

            return(((IRavenQueryInspector)documentQuery).GetLastEqualityTerm());
        }
Example #4
0
        ///<summary>
        /// Get the last equality term for the query
        ///</summary>
        public KeyValuePair <string, object> GetLastEqualityTerm(bool isAsync = false)
        {
            var ravenQueryProvider = new RavenQueryProviderProcessor <T>(
                _provider.QueryGenerator,
                null,
                null,
                _indexName,
                _collectionName,
                new HashSet <FieldToFetch>(),
                _isMapReduce,
                _provider.OriginalQueryType);

            if (isAsync)
            {
                var asyncDocumentQuery = ravenQueryProvider.GetAsyncDocumentQueryFor(_expression);
                return(asyncDocumentQuery.GetLastEqualityTerm(true));
            }

            var documentQuery = ravenQueryProvider.GetDocumentQueryFor(_expression);

            return(documentQuery.GetLastEqualityTerm());
        }
Example #5
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            RavenQueryProviderProcessor <T> ravenQueryProvider = GetRavenQueryProvider();
            string query;

            if (_session is AsyncDocumentSession)
            {
                var asyncDocumentQuery = ravenQueryProvider.GetAsyncDocumentQueryFor(_expression);
                query = asyncDocumentQuery.GetIndexQuery().ToString();
            }
            else
            {
                var documentQuery = ravenQueryProvider.GetDocumentQueryFor(_expression);
                query = documentQuery.ToString();
            }

            string fields = "";

            if (ravenQueryProvider.FieldsToFetch.Count > 0)
            {
                fields = "<" + string.Join(", ", ravenQueryProvider.FieldsToFetch.Select(x => x.Name).ToArray()) + ">: ";
            }
            return(fields + query);
        }