From b01cfa7d98bc2f6bf646aa0e8b4692717544ada4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 14 Sep 2022 10:17:25 +0300 Subject: [PATCH] Introduce IAbpDaprClientFactory --- .../Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs | 7 +++---- .../Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs index faaf450ddc..597c3e74ce 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs @@ -7,10 +7,11 @@ using Volo.Abp.Json.SystemTextJson; namespace Volo.Abp.Dapr; -public class AbpDaprClientFactory : ITransientDependency +public class AbpDaprClientFactory : ITransientDependency, IAbpDaprClientFactory { protected AbpDaprOptions Options { get; } protected AbpSystemTextJsonSerializerOptions SystemTextJsonSerializerOptions { get; } + private readonly static ConcurrentDictionary JsonSerializerOptionsCache = new(); public AbpDaprClientFactory( IOptions options, @@ -38,11 +39,9 @@ public class AbpDaprClientFactory : ITransientDependency return builder.Build(); } - private readonly static ConcurrentDictionary JsonSerializerOptionsCache = new ConcurrentDictionary(); - protected virtual Task CreateJsonSerializerOptions() { return Task.FromResult(JsonSerializerOptionsCache.GetOrAdd(nameof(AbpDaprClientFactory), _ => new JsonSerializerOptions(SystemTextJsonSerializerOptions.JsonSerializerOptions))); } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs new file mode 100644 index 0000000000..12dc15bb67 --- /dev/null +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs @@ -0,0 +1,8 @@ +using Dapr.Client; + +namespace Volo.Abp.Dapr; + +public interface IAbpDaprClientFactory +{ + Task CreateAsync(); +} \ No newline at end of file