Skip to content

Commit 3f1bf24

Browse files
committed
Naming to CosmosClientFactory
1 parent ead1dcb commit 3f1bf24

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/providers/WorkflowCore.Providers.Azure/Interface/ICosmosDbClient.cs renamed to src/providers/WorkflowCore.Providers.Azure/Interface/ICosmosClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace WorkflowCore.Providers.Azure.Interface
44
{
5-
public interface ICosmosDbClient
5+
public interface ICosmosClientFactory
66
{
77
CosmosClient GetCosmosClient();
88
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public static WorkflowOptions UseAzureServiceBusEventHub(
2828

2929
public static WorkflowOptions UseCosmosDbPersistence(this WorkflowOptions options, string connectionString, string databaseId)
3030
{
31-
options.Services.AddSingleton<ICosmosDbClient>(sp => new CosmosDbClient(connectionString));
32-
options.Services.AddTransient<ICosmosDbProvisioner>(sp => new CosmosDbProvisioner(sp.GetService<ICosmosDbClient>(), sp.GetService<ILoggerFactory>()));
33-
options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService<ICosmosDbClient>(), databaseId, sp.GetService<ICosmosDbProvisioner>()));
31+
options.Services.AddSingleton<ICosmosClientFactory>(sp => new CosmosClientFactory(connectionString));
32+
options.Services.AddTransient<ICosmosDbProvisioner>(sp => new CosmosDbProvisioner(sp.GetService<ICosmosClientFactory>(), sp.GetService<ILoggerFactory>()));
33+
options.UsePersistence(sp => new CosmosDbPersistenceProvider(sp.GetService<ICosmosClientFactory>(), databaseId, sp.GetService<ICosmosDbProvisioner>()));
3434
return options;
3535
}
3636
}

src/providers/WorkflowCore.Providers.Azure/Services/CosmosDbClient.cs renamed to src/providers/WorkflowCore.Providers.Azure/Services/CosmosClientFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
namespace WorkflowCore.Providers.Azure.Services
66
{
7-
public class CosmosDbClient : ICosmosDbClient, IDisposable
7+
public class CosmosClientFactory : ICosmosClientFactory, IDisposable
88
{
99
private bool isDisposed = false;
1010

1111
private CosmosClient _client;
1212

13-
public CosmosDbClient(string connectionString)
13+
public CosmosClientFactory(string connectionString)
1414
{
1515
_client = new CosmosClient(connectionString);
1616
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ public class CosmosDbPersistenceProvider : IPersistenceProvider
1919

2020
private ICosmosDbProvisioner _provisioner;
2121
private string _dbId;
22-
private ICosmosDbClient _client;
22+
private ICosmosClientFactory _clientFactory;
2323
private Lazy<Container> _workflowContainer;
2424
private Lazy<Container> _eventContainer;
2525
private Lazy<Container> _subscriptionContainer;
2626

27-
public CosmosDbPersistenceProvider(ICosmosDbClient client, string dbId, ICosmosDbProvisioner provisioner)
27+
public CosmosDbPersistenceProvider(ICosmosClientFactory clientFactory, string dbId, ICosmosDbProvisioner provisioner)
2828
{
2929
_provisioner = provisioner;
3030
_dbId = dbId;
31-
_client = client;
32-
_workflowContainer = new Lazy<Container>(() => _client.GetCosmosClient().GetDatabase(_dbId).GetContainer(WorkflowContainerName));
33-
_eventContainer = new Lazy<Container>(() => _client.GetCosmosClient().GetDatabase(_dbId).GetContainer(EventContainerName));
34-
_subscriptionContainer = new Lazy<Container>(() => _client.GetCosmosClient().GetDatabase(_dbId).GetContainer(SubscriptionContainerName));
31+
_clientFactory = clientFactory;
32+
_workflowContainer = new Lazy<Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(WorkflowContainerName));
33+
_eventContainer = new Lazy<Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(EventContainerName));
34+
_subscriptionContainer = new Lazy<Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(SubscriptionContainerName));
3535
}
3636

3737
public async Task ClearSubscriptionToken(string eventSubscriptionId, string token)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace WorkflowCore.Providers.Azure.Services
99
public class CosmosDbProvisioner : ICosmosDbProvisioner
1010
{
1111

12-
private ICosmosDbClient _client;
12+
private ICosmosClientFactory _client;
1313

14-
public CosmosDbProvisioner(ICosmosDbClient client, ILoggerFactory loggerFactory)
14+
public CosmosDbProvisioner(ICosmosClientFactory client, ILoggerFactory loggerFactory)
1515
{
1616
_client = client;
1717
}

0 commit comments

Comments
 (0)