title: Should my Azure DocumentDB document classes inherit from Microsoft.Azure.Documents.Document?
body: <p>I'm seeing some weird behavior saving to DocumentDB. I started out saving documents using a plain old class that looked like this:</p>
  
  <pre><code>public class Person
  {
      public string Name;
      public int Age;
  }
  </code></pre>
  
  <p>I saved these documents like this:</p>
  
  <pre><code>var person = new Person { ... };
  client.CreateDocumentAsync(myCollectionLink, person);
  </code></pre>
  
  <p>This worked fine. Properties were saved with exactly the names in the class. Then I realized I needed the document's SelfLink in order to perform updates and deletes. "Ah," I thought. "I'll just derive from Document, like so:</p>
  
  <pre><code>public class Person: Microsoft.Azure.Documents.Document
  {
      public string Name;
      public int Age;
  }
  </code></pre>
  
  <p>However, much to my surprise, when I made this change, new documents were created completely blank, except for the "id" property assigned by DocumentDB itself. </p>
  
  <p>I double-checked multiple times. Deriving from Document prevents my custom properties in the document from being saved...</p>
  
  <p>...unless I explicitly decorate each one with [JsonProperty], like so:</p>
  
  <pre><code>public class Person: Document
  {
      [JsonProperty(PropertyName="name")]
      public string Name;
  
      [JsonProperty(PropertyName="age")]
      public int Age;
  }
  </code></pre>
  
  <p>Then it works again (using, of course, the new more JSON-appropriate camelCase property names). And, upon retrieval, the objects get populated with the SelfLink property that I need for updates and deletes. All good.</p>
  
  <p>By my questions are...<strong>Why did this happen? Am I doing something wrong by deriving from Document?</strong> Your feedback would be much appreciated.</p>