IDocumentClient.ExecuteStoredProcedureAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ExecuteStoredProcedureAsync<TValue>(Uri, RequestOptions, CancellationToken, Object[]) |
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service. |
ExecuteStoredProcedureAsync<TValue>(String, RequestOptions, CancellationToken, Object[]) |
Executes a stored procedure against a partitioned collection in the Azure Cosmos DB service as an asynchronous operation, specifiying a target partition. |
ExecuteStoredProcedureAsync<TValue>(Uri, RequestOptions, Object[]) |
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service. |
ExecuteStoredProcedureAsync<TValue>(String, Object[]) |
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service. |
ExecuteStoredProcedureAsync<TValue>(Uri, Object[]) |
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service. |
ExecuteStoredProcedureAsync<TValue>(String, RequestOptions, Object[]) |
Executes a stored procedure against a partitioned collection in the Azure Cosmos DB service as an asynchronous operation, specifiying a target partition. |
ExecuteStoredProcedureAsync<TValue>(Uri, RequestOptions, CancellationToken, Object[])
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (Uri storedProcedureUri, Microsoft.Azure.Documents.Client.RequestOptions options, System.Threading.CancellationToken cancellationToken, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : Uri * Microsoft.Azure.Documents.Client.RequestOptions * System.Threading.CancellationToken * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureUri As Uri, options As RequestOptions, cancellationToken As CancellationToken, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureUri
- Uri
The URI of the stored procedure to be executed.
- options
- RequestOptions
(Optional) The RequestOptions for the request.
- cancellationToken
- CancellationToken
(Optional) A CancellationToken that can be used by other objects or threads to receive notice of cancellation.
- procedureParams
- Object[]
The parameters for the stored procedure execution.
Returns
The task object representing the service response for the asynchronous operation.
Applies to
ExecuteStoredProcedureAsync<TValue>(String, RequestOptions, CancellationToken, Object[])
Executes a stored procedure against a partitioned collection in the Azure Cosmos DB service as an asynchronous operation, specifiying a target partition.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (string storedProcedureLink, Microsoft.Azure.Documents.Client.RequestOptions options, System.Threading.CancellationToken cancellationToken, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : string * Microsoft.Azure.Documents.Client.RequestOptions * System.Threading.CancellationToken * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureLink As String, options As RequestOptions, cancellationToken As CancellationToken, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureLink
- String
The link to the stored procedure to execute.
- options
- RequestOptions
(Optional) The request options for the request.
- cancellationToken
- CancellationToken
(Optional) A CancellationToken that can be used by other objects or threads to receive notice of cancellation.
- procedureParams
- Object[]
(Optional) An array of dynamic objects representing the parameters for the stored procedure.
Returns
The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure.
Exceptions
If storedProcedureLink
is not set.
Examples
//Execute a StoredProcedure with ResourceId of "sproc_rid" that takes two "Player" documents, does some stuff, and returns a bool
StoredProcedureResponse<bool> sprocResponse = await client.ExecuteStoredProcedureAsync<bool>(
"/dbs/db_rid/colls/col_rid/sprocs/sproc_rid/",
new RequestOptions { PartitionKey = new PartitionKey(1) },
new Player { id="1", name="joe" } ,
new Player { id="2", name="john" }
);
if (sprocResponse.Response) Console.WriteLine("Congrats, the stored procedure did some stuff");
See also
Applies to
ExecuteStoredProcedureAsync<TValue>(Uri, RequestOptions, Object[])
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (Uri storedProcedureUri, Microsoft.Azure.Documents.Client.RequestOptions options, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : Uri * Microsoft.Azure.Documents.Client.RequestOptions * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureUri As Uri, options As RequestOptions, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureUri
- Uri
The URI of the stored procedure to be executed.
- options
- RequestOptions
(Optional) The RequestOptions for the request.
- procedureParams
- Object[]
The parameters for the stored procedure execution.
Returns
The task object representing the service response for the asynchronous operation.
Applies to
ExecuteStoredProcedureAsync<TValue>(String, Object[])
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (string storedProcedureLink, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : string * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureLink As String, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureLink
- String
The link to the stored procedure to execute.
- procedureParams
- Object[]
(Optional) An array of dynamic objects representing the parameters for the stored procedure.
Returns
The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure.
Exceptions
If storedProcedureLink
is not set.
Examples
//Execute a StoredProcedure with ResourceId of "sproc_rid" that takes two "Player" documents, does some stuff, and returns a bool
StoredProcedureResponse<bool> sprocResponse = await client.ExecuteStoredProcedureAsync<bool>(
"/dbs/db_rid/colls/col_rid/sprocs/sproc_rid/",
new Player { id="1", name="joe" } ,
new Player { id="2", name="john" }
);
if (sprocResponse.Response) Console.WriteLine("Congrats, the stored procedure did some stuff");
See also
Applies to
ExecuteStoredProcedureAsync<TValue>(Uri, Object[])
Executes a stored procedure against a collection as an asynchronous operation in the Azure Cosmos DB service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (Uri storedProcedureUri, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : Uri * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureUri As Uri, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureUri
- Uri
The URI of the stored procedure to be executed.
- procedureParams
- Object[]
The parameters for the stored procedure execution.
Returns
The task object representing the service response for the asynchronous operation.
Applies to
ExecuteStoredProcedureAsync<TValue>(String, RequestOptions, Object[])
Executes a stored procedure against a partitioned collection in the Azure Cosmos DB service as an asynchronous operation, specifiying a target partition.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<TValue>> ExecuteStoredProcedureAsync<TValue> (string storedProcedureLink, Microsoft.Azure.Documents.Client.RequestOptions options, params object[] procedureParams);
abstract member ExecuteStoredProcedureAsync : string * Microsoft.Azure.Documents.Client.RequestOptions * obj[] -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.StoredProcedureResponse<'Value>>
Public Function ExecuteStoredProcedureAsync(Of TValue) (storedProcedureLink As String, options As RequestOptions, ParamArray procedureParams As Object()) As Task(Of StoredProcedureResponse(Of TValue))
Type Parameters
- TValue
The type of the stored procedure's return value.
Parameters
- storedProcedureLink
- String
The link to the stored procedure to execute.
- options
- RequestOptions
(Optional) The request options for the request.
- procedureParams
- Object[]
(Optional) An array of dynamic objects representing the parameters for the stored procedure.
Returns
The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure.
Exceptions
If storedProcedureLink
is not set.
Examples
//Execute a StoredProcedure with ResourceId of "sproc_rid" that takes two "Player" documents, does some stuff, and returns a bool
StoredProcedureResponse<bool> sprocResponse = await client.ExecuteStoredProcedureAsync<bool>(
"/dbs/db_rid/colls/col_rid/sprocs/sproc_rid/",
new RequestOptions { PartitionKey = new PartitionKey(1) },
new Player { id="1", name="joe" } ,
new Player { id="2", name="john" }
);
if (sprocResponse.Response) Console.WriteLine("Congrats, the stored procedure did some stuff");
See also
Applies to
Azure SDK for .NET