예제 #1
0
        private IQueryable <T> GetSqlBasedQueryableForType <T>(Uri collectionUri, string sql,
                                                               SqlParameterCollection parameters, FeedOptions feedOptions)
        {
            var sqlQuerySpec = parameters != null && parameters.Any() ? new SqlQuerySpec(sql, parameters) : new SqlQuerySpec(sql);
            var queryable    = DocumentClient.CreateDocumentQuery <T>(collectionUri, sqlQuerySpec, feedOptions);

            return(queryable);
        }
        /// <inheritdoc />
        public IQueryable <TEntity> Query(string sql, SqlParameterCollection parameters, FeedOptions feedOptions = null)
        {
            var sqlQuerySpec = parameters != null && parameters.Any() ? new SqlQuerySpec(sql, parameters) : new SqlQuerySpec(sql);
            IQueryable <TEntity> queryable = this.Client.CreateDocumentQuery <TEntity>(UriFactory.CreateDocumentCollectionUri(this.DatabaseId,
                                                                                                                              this.CollectionId), sqlQuerySpec, feedOptions);

            return(queryable);
        }