DocumentClient.ReadStoredProcedureAsync Method

Definition

Overloads

ReadStoredProcedureAsync(String, RequestOptions)

Reads a StoredProcedure from the Azure DocumentDB database service as an asynchronous operation.

ReadStoredProcedureAsync(Uri, RequestOptions)

Reads a StoredProcedure as an asynchronous operation from the Azure DocumentDB database service.

ReadStoredProcedureAsync(String, RequestOptions)

Reads a StoredProcedure from the Azure DocumentDB database service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.StoredProcedure>> ReadStoredProcedureAsync (string storedProcedureLink, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
storedProcedureLink
String

The link of the stored procedure to be read.

options
RequestOptions

(Optional) The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a StoredProcedure containing the read resource record.

Exceptions

If storedProcedureLink is not set.

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
404NotFound - This means the resource you tried to read did not exist.
429TooManyRequests - This means you have exceeded the number of request units per second. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation.

Remarks

Doing a read of a resource is the most efficient way to get a resource from the Database. If you know the resource's ID, do a read instead of a query by ID.

The example shown uses ID-based links, where the link is composed of the ID properties used when the resources were created. You can still use the SelfLink property of the Stored Procedure if you prefer. A self-link is a URI for a resource that is made up of Resource Identifiers (or the _rid properties). ID-based links and SelfLink will both work. The format for storedProcedureLink is always "/dbs/{db identifier}/colls/{coll identifier}/sprocs/{sproc identifier}" only the values within the {...} change depending on which method you wish to use to address the resource.

ReadStoredProcedureAsync(Uri, RequestOptions)

Reads a StoredProcedure as an asynchronous operation from the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.StoredProcedure>> ReadStoredProcedureAsync (Uri storedProcedureUri, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
storedProcedureUri
Uri

A URI to the StoredProcedure resource to be read.

options
RequestOptions

The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a StoredProcedure containing the read resource record.

Exceptions

If storedProcedureUri is not set.

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
404NotFound - This means the resource you tried to read did not exist.
429TooManyRequests - This means you have exceeded the number of request units per second. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation.

Remarks

Doing a read of a resource is the most efficient way to get a resource from the service. If you know the resource's ID, do a read instead of a query by ID.