Created
February 15, 2019 20:11
-
-
Save ealsur/c2cb79d6159830cdad47231d5ef36ca0 to your computer and use it in GitHub Desktop.
Azure Cosmos DB + Functions Cookbook - monitoring - helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class CosmosDBConnectionString | |
{ | |
public CosmosDBConnectionString(string connectionString) | |
{ | |
// Use this generic builder to parse the connection string | |
DbConnectionStringBuilder builder = new DbConnectionStringBuilder | |
{ | |
ConnectionString = connectionString | |
}; | |
if (builder.TryGetValue("AccountKey", out object key)) | |
{ | |
AuthKey = key.ToString(); | |
} | |
if (builder.TryGetValue("AccountEndpoint", out object uri)) | |
{ | |
ServiceEndpoint = new Uri(uri.ToString()); | |
} | |
} | |
public Uri ServiceEndpoint { get; set; } | |
public string AuthKey { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment