We are pleased to announce the release of new functionality in the .NET SDK that makes it easier to develop partition application data using Azure DocumentDB.
During the preview of the DocumentDB service, we found that developers were implementing varied, yet similar, data access layers for partitioning data across collections, like using a lookup table of discrete values or timestamp ranges, or implementing consistent hashing over object IDs. We received clear feedback that adding helper classes or methods for boiler-plate partitioning tasks in the SDKs would simplify the development of large-scale DocumentDB applications.
In order to support partitioning within the SDK, we made the following additions:
- DocumentClient allows you to create and register PartitionResolvers for each database that define how documents are partitioned. Once registered, document operations like create, read-feed and queries can be made directly against databases, and they get automatically get routed to the appropriate collection(s).
- We added “out of the box” support for the two canonical partitioning techniques – a HashPartitionResolver and a RangePartitionResolver. You can configure or extend these partitioners based on your data model and access patterns, or you could implement your own IPartitionResolver from scratch.
To learn more, visit our partitioning tutorial here, or get started by downloading version 1.1.0 of the .NET SDK from Nuget here. We have also created a Github project containing code samples on how to use these new classes or extend them to implement your own custom partitioning logic to fit your scenarios.
If you need any help, please reach out to us on the Azure DocumentDB Developer Forums on MSDN or the developer forums on stack overflow. We are planning to roll out partitioning support in the other SDKs based on your feedback. Please let us know if you would like any additional partitioning functionality in the .NET SDK, or partitioning support in any of the other SDKs through the Azure Feedback forum.