예제 #1
0
    public static string ToCosmosKey(this ICosmosEntity cosmosEntity)
    {
        if (cosmosEntity == null)
        {
            throw new ArgumentNullException(nameof(cosmosEntity));
        }

        var partitionKey = cosmosEntity.GetPartitionKey();

        return(Encode(cosmosEntity.Id, partitionKey));
    }
 protected Uri CreateCollectionUri(ICosmosEntity entity)
 {
     return(UriFactory.CreateDocumentCollectionUri(DatabaseName, CollectionName));
 }
 protected async Task UpsertDocumentAsync(ICosmosEntity updatedDocument)
 {
     await Client.UpsertDocumentAsync(
         CreateCollectionUri(updatedDocument),
         updatedDocument, options : null, disableAutomaticIdGeneration : true);
 }