Closed dbeyda closed 3 weeks ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Found the factory method I can use to set UniqueKey field! Thanks! @ArthurMa1978 Feel free to mark as resolved.
@dbeyda Thank you for using Azure SDK for .NET.
Looks like you have work around this issue using Mock.
Actually, you could use this property:
https://github.com/Azure/azure-sdk-for-net/blob/f03114b97bea85b9028e1a4850270a2e7de2bf3d/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBSqlContainerResourceInfo.cs#L102
This will set the internal property UniqueKeyPolicy
you would like to use. It's by design.
Library name and version
Azure.ResourceManager.CosmosDB 1.3.2.0
Query/Question
Hello! I'm at a codebase where we use ContainerCollection.CreateOrUpdateAsync to create or update our containers.
Notice this method receives a CosmosDBSqlContainerCreateOrUpdateContent , which contains a CosmosDBSqlContainerResourceInfo. ContainerResourceInfo class allows me to set some updatable properties (index, TTL), and also some properties that are only set during container creation (partition key for ex.).
However, I cannot set the UniqueKeys / UniqueKeyPolicy. If you look at code, UniqueKeyPolicy is
internal
.Is there any way I can set this field? If no, is there any particular reason to forbidding outside devs from setting this field?
Thanks a lot!
Environment
Windows 11 / .NET 8.0.303