title: Adding an Attachment to a Document - How To add any file type
body: <p>I am using <strong>Microsoft.Azure.Cosmos</strong> to perform <strong>CRUD</strong> in a C# Blazor app. I'm using the <strong>CosmosClient</strong> - Adding/Updating a simple Customer object. This all works fine.</p>
  
  <p>I would like to add documents to the Customer 'record'. How do you do this? I can't find any good sample code or explainations.</p>
  
  <p>The added document to the customer record could be a file type such as  DOC, PDF, PNG, BMP, JPG etc...  I'd like to support any file type.</p>
  
  <p>I have an existing class that does the normal CRUD.. looks like this, How can I add Attachements as well,
  Any help is appreciated. </p>
  
  <p><em>I do not want to save the document/attachment in separate BLOB, at this time.</em></p>
  
  <pre><code>public class CosmosDbService : ICosmosDbService
      {
          private Microsoft.Azure.Cosmos.Container _container;
          public CosmosDbService(
            CosmosClient dbClient,
            string databaseName,
            string containerName)
          {
              this._container = dbClient.GetContainer(databaseName, containerName);
          }
  
          public async Task AddCustomerAsync(Customer cust)
          {
              await this._container.CreateItemAsync&lt;Customer&gt;(cust, new PartitionKey(fp.Id));
          }
          public async Task DeleteCustomerAsync(string id)
          {
              await this._container.DeleteItemAsync&lt;Customer&gt;(id, new PartitionKey(id));
          }
  </code></pre>