Class UriFactory
Helper class to assist in creating the various Uris needed for use with the DocumentClient instance in the Azure Cosmos DB service.
public static class UriFactory
- Inheritance
-
UriFactory
- Inherited Members
Examples
The example below uses UriFactory to create a DocumentCollectionLink and then uses that to create a Document.
Uri collUri = UriFactory.CreateDocumentCollectionUri("MyDb", "MyCollection");
var doc = await client.CreateDocumentAsync(collUri, new {id = "MyDoc"});
Methods
CreateAttachmentUri(string, string, string, string)
Given a database, collection, document, and attachment id, this creates an attachment link.
public static Uri CreateAttachmentUri(string databaseId, string collectionId, string documentId, string attachmentId)
Parameters
databaseId
stringThe database id
collectionId
stringThe collection id
documentId
stringThe document id
attachmentId
stringThe attachment id
Returns
- Uri
An attachment link in the format of /dbs/{0}/colls/{1}/docs/{2}/attachments/{3} with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
, {2} being thedocumentId
and {3} beingattachmentId
Remarks
Would be used when replacing, or deleting an Attachment in Azure Cosmos DB.
- See Also
CreateCollectionUri(string, string)
Given a database and collection id, this creates a collection link.
[Obsolete("CreateCollectionUri method is deprecated, please use CreateDocumentCollectionUri method instead.")]
public static Uri CreateCollectionUri(string databaseId, string collectionId)
Parameters
Returns
- Uri
A collection link in the format of /dbs/{0}/colls/{1}/ with {0} being a Uri escaped version of the
databaseId
and {1} beingcollectionId
Remarks
Would be used when updating or deleting a DocumentCollection, creating a Document, a StoredProcedure, a Trigger, a UserDefinedFunction, or when executing a query with CreateDocumentQuery in Azure Cosmos DB.
- See Also
CreateConflictUri(string, string, string)
Given a database, collection and conflict id, this creates a conflict link.
public static Uri CreateConflictUri(string databaseId, string collectionId, string conflictId)
Parameters
databaseId
stringThe database id
collectionId
stringThe collection id
conflictId
stringThe conflict id
Returns
- Uri
A conflict link in the format of /dbs/{0}/colls/{1}/conflicts/{2}/ with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
and {2} being theconflictId
Remarks
Would be used when creating a Conflict in Azure Cosmos DB.
- See Also
CreateDatabaseUri(string)
Given a database id, this creates a database link.
public static Uri CreateDatabaseUri(string databaseId)
Parameters
databaseId
stringThe database id
Returns
- Uri
A database link in the format of /dbs/{0}/ with {0} being a Uri escaped version of the
databaseId
Remarks
Would be used when creating or deleting a DocumentCollection or a User in Azure Cosmos DB.
- See Also
CreateDocumentCollectionUri(string, string)
Given a database and collection id, this creates a collection link.
public static Uri CreateDocumentCollectionUri(string databaseId, string collectionId)
Parameters
Returns
- Uri
A collection link in the format of /dbs/{0}/colls/{1}/ with {0} being a Uri escaped version of the
databaseId
and {1} beingcollectionId
Remarks
Would be used when updating or deleting a DocumentCollection, creating a Document, a StoredProcedure, a Trigger, a UserDefinedFunction, or when executing a query with CreateDocumentQuery in Azure Cosmos DB.
- See Also
CreateDocumentUri(string, string, string)
Given a database, collection and document id, this creates a document link.
public static Uri CreateDocumentUri(string databaseId, string collectionId, string documentId)
Parameters
databaseId
stringThe database id
collectionId
stringThe collection id
documentId
stringThe document id
Returns
- Uri
A document link in the format of /dbs/{0}/colls/{1}/docs/{2}/ with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
and {2} being thedocumentId
Remarks
Would be used when creating an Attachment, or when replacing or deleting a Document in Azure Cosmos DB.
- See Also
CreatePartitionKeyRangesUri(string, string)
Given a database and collection, this creates a partition key ranges link in the Azure Cosmos DB service.
public static Uri CreatePartitionKeyRangesUri(string databaseId, string collectionId)
Parameters
Returns
- Uri
A partition key ranges link in the format of /dbs/{0}/colls/{1}/pkranges with {0} being a Uri escaped version of the
databaseId
and {1} beingcollectionId
.
- See Also
CreatePermissionUri(string, string, string)
Given a database and user id, this creates a permission link.
public static Uri CreatePermissionUri(string databaseId, string userId, string permissionId)
Parameters
Returns
- Uri
A permission link in the format of /dbs/{0}/users/{1}/permissions/{2} with {0} being a Uri escaped version of the
databaseId
, {1} beinguserId
and {2} beingpermissionId
Remarks
Would be used when replacing or deleting a Permission in Azure Cosmos DB.
- See Also
CreateStoredProcedureUri(string, string, string)
Given a database, collection and stored proc id, this creates a stored proc link.
public static Uri CreateStoredProcedureUri(string databaseId, string collectionId, string storedProcedureId)
Parameters
databaseId
stringThe database id
collectionId
stringThe collection id
storedProcedureId
stringThe stored procedure id
Returns
- Uri
A stored procedure link in the format of /dbs/{0}/colls/{1}/sprocs/{2}/ with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
and {2} being thestoredProcedureId
Remarks
Would be used when replacing, executing, or deleting a StoredProcedure in Azure Cosmos DB.
- See Also
CreateTriggerUri(string, string, string)
Given a database, collection and trigger id, this creates a trigger link.
public static Uri CreateTriggerUri(string databaseId, string collectionId, string triggerId)
Parameters
databaseId
stringThe database id
collectionId
stringThe collection id
triggerId
stringThe trigger id
Returns
- Uri
A trigger link in the format of /dbs/{0}/colls/{1}/triggers/{2}/ with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
and {2} being thetriggerId
Remarks
Would be used when replacing, executing, or deleting a Trigger in Azure Cosmos DB.
- See Also
CreateUserDefinedFunctionUri(string, string, string)
Given a database, collection and udf id, this creates a udf link.
public static Uri CreateUserDefinedFunctionUri(string databaseId, string collectionId, string udfId)
Parameters
Returns
- Uri
A udf link in the format of /dbs/{0}/colls/{1}/udfs/{2}/ with {0} being a Uri escaped version of the
databaseId
, {1} beingcollectionId
and {2} being theudfId
Remarks
Would be used when replacing, executing, or deleting a UserDefinedFunction in Azure Cosmos DB.
- See Also
CreateUserUri(string, string)
Given a database and user id, this creates a user link.
public static Uri CreateUserUri(string databaseId, string userId)
Parameters
Returns
- Uri
A user link in the format of /dbs/{0}/users/{1}/ with {0} being a Uri escaped version of the
databaseId
and {1} beinguserId
Remarks
Would be used when creating a Permission, or when replacing or deleting a User in Azure Cosmos DB.
- See Also