feta(ClientOptions): add JsonSerializerDateFormat and JsonSerializerOptions.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace Leanetec.EConnect.Infrastructure;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Leanetec.EConnect.Infrastructure;
|
||||
|
||||
public class ClientOptions
|
||||
{
|
||||
@@ -11,4 +13,22 @@ public class ClientOptions
|
||||
public Dictionary<string, string?>? DefaultQueryStrings { get; set; }
|
||||
|
||||
public Action<HttpClient>? AfterHttpInit { get; set; }
|
||||
|
||||
private string? _jsonSerializerDateFormat = null;
|
||||
|
||||
public string? JsonSerializerDateFormat
|
||||
{
|
||||
get => _jsonSerializerDateFormat;
|
||||
set
|
||||
{
|
||||
_jsonSerializerDateFormat = value;
|
||||
if (value is not null)
|
||||
{
|
||||
JsonSerializerOptions ??= new JsonSerializerOptions();
|
||||
JsonSerializerOptions.Converters.Add(new DateTimeConverter(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JsonSerializerOptions? JsonSerializerOptions { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user