diff --git a/src/Finbuckle.MultiTenant/Finbuckle.MultiTenant.csproj b/src/Finbuckle.MultiTenant/Finbuckle.MultiTenant.csproj index b1156272..386e6f9b 100644 --- a/src/Finbuckle.MultiTenant/Finbuckle.MultiTenant.csproj +++ b/src/Finbuckle.MultiTenant/Finbuckle.MultiTenant.csproj @@ -8,42 +8,42 @@ - - + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + + diff --git a/src/Finbuckle.MultiTenant/Stores/DistributedCacheStore/DistributedCacheStore.cs b/src/Finbuckle.MultiTenant/Stores/DistributedCacheStore/DistributedCacheStore.cs index 652e8b29..70288eb3 100644 --- a/src/Finbuckle.MultiTenant/Stores/DistributedCacheStore/DistributedCacheStore.cs +++ b/src/Finbuckle.MultiTenant/Stores/DistributedCacheStore/DistributedCacheStore.cs @@ -1,11 +1,11 @@ // Copyright Finbuckle LLC, Andrew White, and Contributors. // Refer to the solution LICENSE file for more inforation. +using Microsoft.Extensions.Caching.Distributed; using System; using System.Collections.Generic; +using System.Text.Json; using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Distributed; -using Newtonsoft.Json; namespace Finbuckle.MultiTenant.Stores { @@ -25,7 +25,8 @@ public DistributedCacheStore(IDistributedCache cache, string keyPrefix, TimeSpan public async Task TryAddAsync(TTenantInfo tenantInfo) { var options = new DistributedCacheEntryOptions { SlidingExpiration = slidingExpiration }; - var bytes = JsonConvert.SerializeObject(tenantInfo); + var bytes = JsonSerializer.Serialize(tenantInfo); + await cache.SetStringAsync($"{keyPrefix}id__{tenantInfo.Id}", bytes, options); await cache.SetStringAsync($"{keyPrefix}identifier__{tenantInfo.Identifier}", bytes, options); @@ -38,7 +39,7 @@ public async Task TryAddAsync(TTenantInfo tenantInfo) if (bytes == null) return null; - var result = JsonConvert.DeserializeObject(bytes); + var result = JsonSerializer.Deserialize(bytes); // Refresh the identifier version to keep things synced await cache.RefreshAsync($"{keyPrefix}identifier__{result.Identifier}"); @@ -57,7 +58,7 @@ public Task> GetAllAsync() if (bytes == null) return null; - var result = JsonConvert.DeserializeObject(bytes); + var result = JsonSerializer.Deserialize(bytes); // Refresh the identifier version to keep things synced await cache.RefreshAsync($"{keyPrefix}id__{result.Id}"); diff --git a/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs b/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs index ee464233..07852649 100644 --- a/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs +++ b/src/Finbuckle.MultiTenant/Stores/HttpRemoteStore/HttpRemoteStoreClient.cs @@ -3,8 +3,8 @@ using System; using System.Net.Http; +using System.Text.Json; using System.Threading.Tasks; -using Newtonsoft.Json; namespace Finbuckle.MultiTenant.Stores { @@ -27,7 +27,7 @@ public HttpRemoteStoreClient(IHttpClientFactory clientFactory) return null; var json = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(json); + var result = JsonSerializer.Deserialize(json); return result; }