feta(ClientOptions): add JsonSerializerDateFormat and JsonSerializerOptions.
This commit is contained in:
parent
6b2c897e5b
commit
6836b422a4
@ -1,4 +1,6 @@
|
|||||||
namespace Leanetec.EConnect.Infrastructure;
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace Leanetec.EConnect.Infrastructure;
|
||||||
|
|
||||||
public class ClientOptions
|
public class ClientOptions
|
||||||
{
|
{
|
||||||
@ -11,4 +13,22 @@ public class ClientOptions
|
|||||||
public Dictionary<string, string?>? DefaultQueryStrings { get; set; }
|
public Dictionary<string, string?>? DefaultQueryStrings { get; set; }
|
||||||
|
|
||||||
public Action<HttpClient>? AfterHttpInit { 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; }
|
||||||
}
|
}
|
||||||
@ -9,7 +9,8 @@
|
|||||||
"EConnect": {
|
"EConnect": {
|
||||||
"BaseAddress": "https://portal.demoportal01.leanetec.com",
|
"BaseAddress": "https://portal.demoportal01.leanetec.com",
|
||||||
"DefaultQueryStrings": {
|
"DefaultQueryStrings": {
|
||||||
"apiKey": "HGpGp3vk3MsKgSe0tKVZ1ZRCuq6bFoJ1"
|
"apiKey": "HGpGp3vk3MsKgSe0tKVZ1ZRCuq6bFoJ1",
|
||||||
|
"JsonSerializerDateFormat": "yyyy-MM-dd HH:mm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user