public override Task <CosmosItemResponse <TOutput> > ExecuteAsync <TInput, TOutput>( object partitionKey, TInput input, CosmosStoredProcedureRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { CosmosItemsCore.ValidatePartitionKey(partitionKey, requestOptions); Stream parametersStream; if (input != null && !input.GetType().IsArray) { parametersStream = this.Client.CosmosJsonSerializer.ToStream <TInput[]>(new TInput[1] { input }); } else { parametersStream = this.Client.CosmosJsonSerializer.ToStream <TInput>(input); } Task <CosmosResponseMessage> response = ExecUtils.ProcessResourceOperationStreamAsync( this.Client, this.LinkUri, ResourceType.StoredProcedure, OperationType.ExecuteJavaScript, requestOptions, partitionKey, parametersStream, null, cancellationToken); return(this.Client.ResponseFactory.CreateItemResponse <TOutput>(response)); }
public override Task <CosmosItemResponse <TOutput> > ExecuteAsync <TInput, TOutput>( object partitionKey, TInput input, CosmosStoredProcedureRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { CosmosItemsCore.ValidatePartitionKey(partitionKey, requestOptions); Stream parametersStream; if (input != null && !input.GetType().IsArray) { parametersStream = this.clientContext.JsonSerializer.ToStream <TInput[]>(new TInput[1] { input }); } else { parametersStream = this.clientContext.JsonSerializer.ToStream <TInput>(input); } Task <CosmosResponseMessage> response = this.clientContext.ProcessResourceOperationStreamAsync( resourceUri: this.LinkUri, resourceType: ResourceType.StoredProcedure, operationType: OperationType.ExecuteJavaScript, requestOptions: requestOptions, cosmosContainerCore: this.container, partitionKey: partitionKey, streamPayload: parametersStream, requestEnricher: null, cancellationToken: cancellationToken); return(this.clientContext.ResponseFactory.CreateItemResponse <TOutput>(response)); }
internal Task <CosmosResponseMessage> ProcessItemStreamAsync( object partitionKey, string itemId, Stream streamPayload, OperationType operationType, CosmosRequestOptions requestOptions, CancellationToken cancellationToken) { CosmosItemsCore.ValidatePartitionKey(partitionKey, requestOptions); Uri resourceUri = this.GetResourceUri(requestOptions, operationType, itemId); return(this.clientContext.ProcessResourceOperationStreamAsync( resourceUri, ResourceType.Document, operationType, requestOptions, this.container, partitionKey, streamPayload, null, cancellationToken)); }