12 lines
494 B
C#
12 lines
494 B
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
public sealed class DepartmentJsonConverter : JsonConverter<Department>
|
|
{
|
|
public override Department Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
=> DbStringEnumJson.Read(ref reader, DepartmentExtensions.FromDbString);
|
|
|
|
public override void Write(Utf8JsonWriter writer, Department value, JsonSerializerOptions options)
|
|
=> writer.WriteStringValue(value.ToDbString());
|
|
}
|