public CosmosRepository(CosmosDbSettings settings) { Guard.ArgumentNotNull(settings, nameof(settings)); Guard.IsNullOrWhiteSpace(settings.CollectionName, nameof(settings.CollectionName)); Guard.IsNullOrWhiteSpace(settings.ConnectionString, nameof(settings.ConnectionString)); Guard.IsNullOrWhiteSpace(settings.DatabaseName, nameof(settings.DatabaseName)); _collectionName = settings.CollectionName; _partitionKey = settings.PartitionKey; _databaseName = settings.DatabaseName; _documentClient = CosmosDbConnectionString.Parse(settings.ConnectionString); _collectionUri = UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName); }
protected virtual CosmosClient GetClient(string connectionString, CosmosClientOptions cosmosClientOptions) { return CosmosDbConnectionString.Parse(connectionString, cosmosClientOptions); }