diff --git a/src/providers/WorkflowCore.Providers.Azure/ServiceCollectionExtensions.cs b/src/providers/WorkflowCore.Providers.Azure/ServiceCollectionExtensions.cs index 0aa1963e4..d6aec277d 100644 --- a/src/providers/WorkflowCore.Providers.Azure/ServiceCollectionExtensions.cs +++ b/src/providers/WorkflowCore.Providers.Azure/ServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using Microsoft.Azure.Cosmos; +using Microsoft.Extensions.Logging; using WorkflowCore.Interface; using WorkflowCore.Models; using WorkflowCore.Providers.Azure.Interface; @@ -31,14 +32,15 @@ public static WorkflowOptions UseCosmosDbPersistence( this WorkflowOptions options, string connectionString, string databaseId, - CosmosDbStorageOptions cosmosDbStorageOptions = null) + CosmosDbStorageOptions cosmosDbStorageOptions = null, + CosmosClientOptions clientOptions = null) { if (cosmosDbStorageOptions == null) { cosmosDbStorageOptions = new CosmosDbStorageOptions(); } - options.Services.AddSingleton(sp => new CosmosClientFactory(connectionString)); + options.Services.AddSingleton(sp => new CosmosClientFactory(connectionString, clientOptions)); options.Services.AddTransient(sp => new CosmosDbProvisioner(sp.GetService(), cosmosDbStorageOptions)); options.Services.AddSingleton(sp => new WorkflowPurger(sp.GetService(), databaseId, cosmosDbStorageOptions)); options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService(), databaseId, sp.GetService(), cosmosDbStorageOptions)); diff --git a/src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs b/src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs index 9cb4cc572..ac5dc7f4a 100644 --- a/src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs +++ b/src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs @@ -10,9 +10,9 @@ public class CosmosClientFactory : ICosmosClientFactory, IDisposable private CosmosClient _client; - public CosmosClientFactory(string connectionString) + public CosmosClientFactory(string connectionString, CosmosClientOptions clientOptions = null) { - _client = new CosmosClient(connectionString); + _client = new CosmosClient(connectionString, clientOptions); } public CosmosClient GetCosmosClient()