plcsharp/PLCSharpWpf/Core/Tools/JsonOptions.cs
2026-07-21 19:51:09 +08:00

29 lines
793 B
C#

#nullable enable
using System.Text.Json;
namespace PLCSharp.Core.Tools
{
/// <summary>
/// 全局共享的 System.Text.Json 序列化选项。
/// </summary>
public static class JsonOptions
{
/// <summary>
/// 默认选项:属性名大小写不敏感(用于 EF Core 列序列化 / 反序列化)。
/// </summary>
public static JsonSerializerOptions Default { get; } = new()
{
PropertyNameCaseInsensitive = true,
};
/// <summary>
/// 缩进输出选项(用于配置文件读写)。
/// </summary>
public static JsonSerializerOptions Indented { get; } = new()
{
PropertyNameCaseInsensitive = true,
WriteIndented = true,
};
}
}