title: How to get all items from a specific type in CosmosDB
body: <p>I have the following DocumentDBRepository</p>
  
  <pre><code>using Microsoft.Azure.Documents;
  using Microsoft.Azure.Documents.Client;
  using Microsoft.Azure.Documents.Linq;
  using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Linq;
  using System.Linq.Expressions;
  using System.Threading.Tasks;
  using System.Web;
  
  namespace TenantManagementWebApi.DataAccess
  {
      public static class DocumentDBRepository&lt;T&gt; where T : class
      {
          private static readonly string DatabaseId = ConfigurationManager.AppSettings["database"];
          private static readonly string CollectionId = ConfigurationManager.AppSettings["collection"];
          private static DocumentClient client;
  
          public static async Task&lt;T&gt; GetItemAsync(string id)
          {
              try
              {
                  Document document = await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, id));
                  return (T)(dynamic)document;
              }
              catch (DocumentClientException e)
              {
                  if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
                  {
                      return null;
                  }
                  else
                  {
                      throw;
                  }
              }
          }
  
          public static async Task&lt;IEnumerable&lt;T&gt;&gt; GetItemsAsync(Expression&lt;Func&lt;T, bool&gt;&gt; predicate)
          {
              IDocumentQuery&lt;T&gt; query = client.CreateDocumentQuery&lt;T&gt;(
                  UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId),
                  new FeedOptions { MaxItemCount = -1 })
                  .Where(predicate)
                  .AsDocumentQuery();
  
              List&lt;T&gt; results = new List&lt;T&gt;();
              while (query.HasMoreResults)
              {
                  results.AddRange(await query.ExecuteNextAsync&lt;T&gt;());
              }
  
              return results;
          }
  
          public static async Task&lt;Document&gt; CreateItemAsync(T item)
          {
              return await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), item);
          }
  
          public static async Task&lt;Document&gt; UpdateItemAsync(string id, T item)
          {
              return await client.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, id), item);
          }
  
          public static async Task DeleteItemAsync(string id)
          {
              await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, id));
          }
  
          public static void Initialize()
          {
              client = new DocumentClient(new Uri(ConfigurationManager.AppSettings["endpoint"]), ConfigurationManager.AppSettings["authKey"]);
              CreateDatabaseIfNotExistsAsync().Wait();
              CreateCollectionIfNotExistsAsync().Wait();
          }
  
          private static async Task CreateDatabaseIfNotExistsAsync()
          {
              try
              {
                  await client.ReadDatabaseAsync(UriFactory.CreateDatabaseUri(DatabaseId));
              }
              catch (DocumentClientException e)
              {
                  if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
                  {
                      await client.CreateDatabaseAsync(new Database { Id = DatabaseId });
                  }
                  else
                  {
                      throw;
                  }
              }
          }
  
          private static async Task CreateCollectionIfNotExistsAsync()
          {
              try
              {
                  await client.ReadDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId));
              }
              catch (DocumentClientException e)
              {
                  if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
                  {
                      await client.CreateDocumentCollectionAsync(
                          UriFactory.CreateDatabaseUri(DatabaseId),
                          new DocumentCollection { Id = CollectionId },
                          new RequestOptions { OfferThroughput = 1000 });
                  }
                  else
                  {
                      throw;
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>And I need to get all items from a specific type (eg Tenant)</p>
  
  <pre><code>  public class TenantController : ApiController
      {
          private static DocumentClient client;
  
          public TenantController()
          {
              client = new DocumentClient(new Uri(ConfigurationManager.AppSettings["endpoint"]), ConfigurationManager.AppSettings["authKey"]);
          }
  
          public async Task&lt;IQueryable&lt;Tenant&gt;&gt; GetTenants()
          {
              return await  DocumentDBRepository&lt;IQueryable&lt;Tenant&gt;&gt;.GetItemsAsync());
          }
  </code></pre>
  
  <p>Error is obvious:</p>
  
  <pre><code>There is no argument given that corresponds to the required formal parameter 'predicate' of 'DocumentDBRepository&lt;IQueryable&lt;Tenant&gt;&gt;.GetItemsAsync(Expression&lt;Func&lt;IQueryabl
  </code></pre>
  
  <p>BUt I need to send no predicate because I want to get all items from a specific type of object:</p>
  
  <pre><code> public class Tenant
      {
          public string TenantId { get; set; }
          public string TenantUrl { get; set; }
          public string CertificatePath { get; set; }
          public string CertificatePassword { get; set; }
  
          public override string ToString()
          {
              return JsonConvert.SerializeObject(this);
          }
      }
  </code></pre>