init
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Ellenorzo.Domain.VN.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Ellenorzo.Dto.VN.Converter
|
||||
{
|
||||
/// <summary>
|
||||
/// Author: Kovács Kornél (DevKornél) Created On: 2019.10.
|
||||
/// This converts the Uid dto model prop to a string value.
|
||||
/// </summary>
|
||||
public class UidConverter<T> : JsonConverter where T : IReadonlyUidRaw
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value is IReadonlyUidRaw propertyValue ? propertyValue.UidRaw : throw new BlException(Core.Enum.BlExceptionType.ElvartErtekNemTalalhato));
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) => throw new NotImplementedException();
|
||||
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override bool CanConvert(Type objectType) => objectType == typeof(string);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user