Skip to content

Commit 470987d

Browse files
authored
Merge pull request #1062 from afroze9/master
Added CosmosClientOptions to UseCosmosDbPersistence method and CosmosClientFactory constructor
2 parents 4f085d1 + e0107a0 commit 470987d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/providers/WorkflowCore.Providers.Azure/ServiceCollectionExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Extensions.Logging;
1+
using Microsoft.Azure.Cosmos;
2+
using Microsoft.Extensions.Logging;
23
using WorkflowCore.Interface;
34
using WorkflowCore.Models;
45
using WorkflowCore.Providers.Azure.Interface;
@@ -31,14 +32,15 @@ public static WorkflowOptions UseCosmosDbPersistence(
3132
this WorkflowOptions options,
3233
string connectionString,
3334
string databaseId,
34-
CosmosDbStorageOptions cosmosDbStorageOptions = null)
35+
CosmosDbStorageOptions cosmosDbStorageOptions = null,
36+
CosmosClientOptions clientOptions = null)
3537
{
3638
if (cosmosDbStorageOptions == null)
3739
{
3840
cosmosDbStorageOptions = new CosmosDbStorageOptions();
3941
}
4042

41-
options.Services.AddSingleton<ICosmosClientFactory>(sp => new CosmosClientFactory(connectionString));
43+
options.Services.AddSingleton<ICosmosClientFactory>(sp => new CosmosClientFactory(connectionString, clientOptions));
4244
options.Services.AddTransient<ICosmosDbProvisioner>(sp => new CosmosDbProvisioner(sp.GetService<ICosmosClientFactory>(), cosmosDbStorageOptions));
4345
options.Services.AddSingleton<IWorkflowPurger>(sp => new WorkflowPurger(sp.GetService<ICosmosClientFactory>(), databaseId, cosmosDbStorageOptions));
4446
options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService<ICosmosClientFactory>(), databaseId, sp.GetService<ICosmosDbProvisioner>(), cosmosDbStorageOptions));

src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public class CosmosClientFactory : ICosmosClientFactory, IDisposable
1010

1111
private CosmosClient _client;
1212

13-
public CosmosClientFactory(string connectionString)
13+
public CosmosClientFactory(string connectionString, CosmosClientOptions clientOptions = null)
1414
{
15-
_client = new CosmosClient(connectionString);
15+
_client = new CosmosClient(connectionString, clientOptions);
1616
}
1717

1818
public CosmosClient GetCosmosClient()

0 commit comments

Comments
 (0)