Skip to content

Instantly share code, notes, and snippets.

@PradeepLoganathan
Last active November 2, 2020 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PradeepLoganathan/b65bd38eeb9bd1dc622d8fa075f9437e to your computer and use it in GitHub Desktop.
Save PradeepLoganathan/b65bd38eeb9bd1dc622d8fa075f9437e to your computer and use it in GitHub Desktop.
public static class CosmosDbConnection
{
private const string EndpointUri = "https://localhost:8081";
private const string PrimaryKey = "yourprimarykey==";
private static CosmosClient _instance = null;
private static readonly CosmosClientOptions CosmosClientOptions = new CosmosClientOptions()
{
ConnectionMode = ConnectionMode.Direct,
ApplicationName = "CosmosStarter"
};
public static CosmosClient Instance => _instance ??= new CosmosClient(EndpointUri, PrimaryKey, CosmosClientOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment