Skip to content

Draft: Migration from v2 to v3 SDK

j82w edited this page Sep 19, 2019 · 6 revisions

Draft Migration from v2 to v3 SDK

Name Changes

Resource

  1. Collection -> Container
  2. Documents -> Items

Class

  1. DocumentClient -> CosmosClient
  2. ConnectionPolicy -> CosmosClientOptions
  3. Database -> DatabaseProperties
  4. DocumentCollection -> ContainerProperties
  5. Document -> Not available
  6. StoredProcedure -> StoredProcedureProperties
  7. Trigger -> TriggerProperties

Settings

  1. v3 defaults to Direct + TCP because it gives better performance and scalability over Gateway + HTTPS.

Removed

  1. UriFactory is replaced by the Fluent design. The fluent design builds the URLs internally which allows a single Container object to be passed around instead of a DocumentClient, DatabaseName, and collection name.
  2. Document and Resource class do not exist in v3. A lot of issues were caused by these classes. For example the Documentclass would sometimes not serialize properties if they were not properly set.
  3. Document id is not auto populated in v3. To auto populate the id it requires the document to be parsed and checked if the id exists which causes an unnecessary performance hit for most users. An Extension Method can be implemented to add the same functionality.
Clone this wiki locally